Thanks for the response. There are a few things that I can't seem to understand though. why is the camera forward -/negative? does this mean that backwards is +/positive. is this the same of the other axis's too? The full Code is below
func _input(event):
if(!lockCamera):
if event.type == InputEvent.MOUSE_MOTION:
pitch = max(min(pitch + (event.relative_y * camera_sensitivity), camera_pitch_minMax.x), camera_pitch_minMax.y);
yaw = fmod(yaw - (event.relative_x * camera_sensitivity), 360);
if( Input.is_mouse_button_pressed(BUTTON_MIDDLE) && cameraMode == "Battle Cam" ):
free_movement = !free_movement;
if(free_movement):
#scroll the camera in and out of the battle
if(Input.is_mouse_button_pressed(BUTTON_WHEEL_UP)):
radius = max(min(radius - 0.2, max_radius_offset), 1.0);
elif(Input.is_mouse_button_pressed(BUTTON_WHEEL_DOWN)):
radius = max(min(radius + 0.2, max_radius_offset), 1.0);
func CameraMotion(var target, var delta):
#set the camera FOV
if(get_projection() == Camera.PROJECTION_PERSPECTIVE):
set_perspective(lerp(get_fov(), camera_fov, camera_smooth_lerp * delta), get_znear(), get_zfar());
current_pitch = lerp(current_pitch, pitch, 10 * delta);
current_yaw = lerp(current_yaw, yaw, 10 * delta);
current_radius = lerp(current_radius, radius, 5 * delta)
#get the pivots original position
camera_pos = target.get_global_transform().origin;
camera_pos.x += current_radius * sin(deg2rad(current_yaw)) * cos(deg2rad(current_pitch));
camera_pos.y += current_radius * sin(deg2rad(current_pitch));
camera_pos.z += current_radius * cos(deg2rad(current_yaw)) * cos(deg2rad(current_pitch));
#set the position and target to look at
look_at_from_pos(camera_pos , target.get_global_transform().origin, Vector3(0,1,0));