There's a function called node.set_as_toplevel(), if you put true inside the parentheses, the node will be set as "top level". That way, you can have a node as a child of another node, but it won't inherit position or rotation from any of its parents. I don't use it for my camera, but it is useful to know(I don't need it, I rotate the camera with look_at()).

You haven't fixed the camera yet, right? What problem are you currently working on?

@Dschoonmaker I haven't made much progress. I get an error. On line 34-36. The function that controls camera rotation with mouse movement. rotation_degrees.y -= event.relative.x * mouse_sensitivity camera_pivot.rotation_degrees.x -= event.relative.y * mouse_sensitivity "invalid get index 'rotation_degrees' on base : ( 'null instance') I think my previous code conflicts with the insightful suggestions I've been given I am not sure. I'm trying to do things on step at a time. make the player turn when they move, make the camera rotate with mouse etc.

Is camera_pivot a variable? If so, can you show me the line where you declare it? If not, I guess that you're trying to reference a child of the player node. If so, you can get a child with $, so this:

camera_pivot.rotation_degrees.x

should be this:

$camera_pivot.rotation_degrees.x

$ only works for getting children, though. I'm assuming that camera_pivot is a child of the player node, and that camera_pivot is a node itself.

@Dschoonmaker said: Is camera_pivot a variable? If so, can you show me the line where you declare it? If not, I guess that you're trying to reference a child of the player node. If so, you can get a child with $, so this:

camera_pivot.rotation_degrees.x

should be this:

$camera_pivot.rotation_degrees.x

$ only works for getting children, though. I'm assuming that camera_pivot is a child of the player node, and that camera_pivot is a node itself.

I think you are right. It is a variable defined as so: onready var camera = $cameraRig/SpringArm/Camera and I didn't have the $ preceding it. I will try this.

@Dschoonmaker I tried the fix and it didn't fix the issue, the error still remains

@Dschoonmaker said: Can I see your code?

absolutely. and for whatever reason when I preview this message it looks very strange so sorry for that.

extends KinematicBody
#old variables
export var speed : float = 20
export var acceleration : float = 15
export var air_acceleration : float = 5
export var gravity : float = 0.98
export var max_terminal_velocity : float = 54
export var jump_power : float = 20
export(float, 0.1, 1) var mouse_sensitivity : float = 0.3
export(float, -90, 0) var min_pitch : float = -90
export(float, 0, 90) var max_pitch : float = 90

var moveDir : Vector3
var y_velocity : float
onready var camera_pivot = $player
onready var camera = $cameraRig/SpringArm/Camera
#new variables
var cameraAngle = Vector2.ZERO
var cameraZoom = 2.25
var cameraOffset = Vector3(0,1.5,0)

#clamping camera varibales
#capturing mouse input
func _ready():
	Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
#making cursor visible on ui cancel

func _process(delta):
	if Input.is_action_just_pressed("ui_cancel"):
		Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
#rotate camera with mouse input?

func _input(event):
	if event is InputEventMouseMotion:
		rotation_degrees.y -= event.relative.x * mouse_sensitivity
		$camera_pivot.rotation_degrees.x -= event.relative.y * mouse_sensitivity
		$camera_pivot.rotation_degrees.x = clamp(camera_pivot.rotation_degrees.x, min_pitch, max_pitch)
func _physics_process(delta):
	handle_movement(delta)
	update_camera()
	
	
func update_camera():
	cameraAngle.x = fmod(cameraAngle.x, 2*PI)
	cameraAngle.y = clamp(cameraAngle.y, 0.01, PI-0.01)
	$Camera.translation = Vector3.ZERO
	#X+=sqrt(cameraZoom)*sin(cameraAngle.y)*(sqrt(cameraZoom)*cos(cameraAngle.x))
	#Z+=sqrt(cameraZoom)*sin(cameraAngle.y)*(sqrt(cameraZoom)*sin(cameraAngle.x))
	#Y+=cameraZoom*cos(cameraAngle.y)
	
	$Camera.translation.x+=sqrt(cameraZoom)*sin(cameraAngle.y)*(sqrt(cameraZoom)*cos(cameraAngle.x))
	$Camera.translation.z+=sqrt(cameraZoom)*sin(cameraAngle.y)*(sqrt(cameraZoom)*sin(cameraAngle.x))
	$Camera.translation.y+=cameraZoom*cos(cameraAngle.y)
	
func handle_movement(delta):
	#clamping moveDir
	moveDir = Vector3(clamp(moveDir.x, -1, 1),clamp(moveDir.y, -1, 1),clamp(moveDir.z, -1, 1))
	#moveDir
	moveDir.x -= cos(cameraAngle.x)*Input.get_action_strength("move_forward")
	moveDir.z -= sin(cameraAngle.x)*Input.get_action_strength("move_forward")
	moveDir.x -= cos(cameraAngle.x+PI)*Input.get_action_strength("move_backward")
	moveDir.z -= sin(cameraAngle.x+PI)*Input.get_action_strength("move_backward")
	moveDir.x -= cos(cameraAngle.x+(270*PI/180))*Input.get_action_strength("move_left")
	moveDir.z -= sin(cameraAngle.x+(270*PI/180))*Input.get_action_strength("move_left")
	moveDir.x -= cos(cameraAngle.x+(90*PI/180))*Input.get_action_strength("move_right")
	moveDir.z -= sin(cameraAngle.x+(90*PI/180))*Input.get_action_strength("move_right")
	moveDir = moveDir.normalized()
	var accel = acceleration if is_on_floor() else air_acceleration
	moveDir = moveDir.linear_interpolate(moveDir * speed, accel * delta)
	
	if is_on_floor():
		y_velocity = -0.01
	else:
		y_velocity = clamp(y_velocity - gravity, -max_terminal_velocity, max_terminal_velocity)
	if Input.is_action_just_pressed("jump") and is_on_floor():
		y_velocity = jump_power
		
	moveDir.y = y_velocity
	moveDir = move_and_slide(moveDir, Vector3.UP)

Two things:

You're not updating cameraAngle. It looks like you rotate a node based on mouse movement, instead you should be changing cameraAngle. This should work:

func _input(event):
	if event is InputEventMouseMotion:
		cameraAngle.x += event.relative.x
		cameraAngle.y += event.relative.y

Second, in the part where you move the camera, the camera's position needs to be set before changing the camera position. I set it to cameraOffset, so that the camera orbits around cameraOffset instead of Vector3(0,0,0).

$Camera.translation = cameraOffset
$Camera.translation.x+=sqrt(cameraZoom)*sin(cameraAngle.y)*(sqrt(cameraZoom)*cos(cameraAngle.x))
$Camera.translation.z+=sqrt(cameraZoom)*sin(cameraAngle.y)*(sqrt(cameraZoom)*sin(cameraAngle.x))
$Camera.translation.y+=cameraZoom*cos(cameraAngle.y)

Those are the only two problems I found, I think it should work after you fix these.

@Dschoonmaker I've made the changes you suggested and I now have an error on the $Camera.translation = cameraOffset line. It reads: Invalid set index 'translation' (on base: 'null instance') with value type 'Vector3'. I still have CameraOffset defined at the top.

func _physics_process(delta):
	handle_movement(delta)
	update_camera()
	
func update_camera():
	cameraAngle.x = fmod(cameraAngle.x, 2*PI)
	cameraAngle.y = clamp(cameraAngle.y, 0.01, PI-0.01)
	$Camera.translation = cameraOffset
	
	$Camera.translation.x+=sqrt(cameraZoom)*sin(cameraAngle.y)*(sqrt(cameraZoom)*cos(cameraAngle.x))
	$Camera.translation.z+=sqrt(cameraZoom)*sin(cameraAngle.y)*(sqrt(cameraZoom)*sin(cameraAngle.x))
	$Camera.translation.y+=cameraZoom*cos(cameraAngle.y)

Is "Camera"(case sensitive) a direct child of the node with this script? It looks like it knows cameraOffset is a Vector3, so I think the problem is with $Camera.translation.

@Dschoonmaker said: Is "Camera"(case sensitive) a direct child of the node with this script? It looks like it knows cameraOffset is a Vector3, so I think the problem is with $Camera.translation. If by direct child you mean just a single node attached, no. Camera is an extensive child here, a child of the spring arm, which is a child of spatial, which is a child of the player (spatial). Does camera need to be a part of its own scene or does the spring arm and such need to be removed. Camera is spelt "Camera"

By direct child, I meant directly parented to the player. The reason it doesn't work is because the camera is a child of another node, which is a child of the player. Sounds to me like the spatial node is unnecessary, what is the spring arm node for? For now, maybe you could put the camera node directly under the player, to test if it works.

@Dschoonmaker here is the current node set up and i still have the error.

The error is there because the camera is not a child of the KinematicBody node. $ returns a child node, and your camera is not a child of the node with the player script(KinematicBody).

In fact I'd have the kinematicbody node be named player and be the root of the player scene

@Dschoonmaker I have made the changes and the program runs. However, There is something wrong with the view I get. The camera is within the cube(player) and after changing the node type to an interpolated camera and re positing the problem remains. Also , turning looks very glitch-y, I see a gray block at the top of the screen.

Interpolated Camera is not what you need here, Godot says it's a "Camera which moves toward another node".

The gray block isn't from the camera script. Does the camera move at all? Does the player move? What do you have in this scene(probably more than this picture shows)? You could try printing the camera position, and see if that helps?

If you can't figure it out, you could upload the whole project somewhere, and I can try to fix it.

That square towards the top looks like there's something wrong with the environment rendering. Assuming that it is internally perhaps a cubemap/skybox one of the faces fails to render or something like that. At least that is my guess.

edit: or if the players meshinstance is a cube then that might be above the camera. Or if the cubes top face has flipped normal pointing inside then it would be visible.