Cannot control the camera with the mouse while it is attached to a rotating 3D object

So I’m working on a few 3d projects to learn the engine. In the first one, following this tutorial for a basic 3D platformer: https://www.youtube.com/watch?v=sVsn9NqpVhg&t=292s&ab_channel=Bramwell

I was able to get the camera working fine. Recently, I wanted to learn about angular velocity, so I followed this tutorial to make a 3D rolling ball platformer: https://www.youtube.com/watch?v=_7riD3FaZgI&ab_channel=GodotAcademy

but I wanted to implement the mouse movement from the first tutorial. Right now, the camera is centered on the ball and cannot move. I’ve only implemented the y-axis rotation (x-axis mouse movement), but for some reason Godot is saying that the rotation_y function is an invalid call, while it worked fine in the previous game test I did. Here is the code which is exclusively housed in the script attached to the ball node:

extends RigidBody3D

var mouse_sensitivity := 0.001
var twist_input := 0.0
var pitch_input := 0.0

@export var rolling_force = 40
@export var jump_impulse = 1000


func _ready():
	Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
	$TwistPivot.top_level = true
 

func _physics_process(delta):
	$TwistPivot.rotation_y(twist_input) #here is the outstanding issue
	$TwistPivot.transform.origin = transform.origin
	
	if Input.is_action_pressed("Forwards"):
		angular_velocity.z -= rolling_force*delta
	elif Input.is_action_pressed("Backwards"):
		angular_velocity.z += rolling_force*delta
	if Input.is_action_pressed("Left"):
		angular_velocity.x -= rolling_force*delta
	elif Input.is_action_pressed("Right"):
		angular_velocity.x += rolling_force*delta
	
	if Input.is_action_just_pressed("ui_cancel"):
		Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
	
	if Input.is_action_just_pressed("Click"):
		Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)


func _unhandled_input(event: InputEvent) -> void:
		if event is InputEventMouseMotion:
			if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
				twist_input = - event.relative.x * mouse_sensitivity
				pitch_input = - event.relative.y * mouse_sensitivity

Any ideas on what could be done? I’m stuck on this single thing.

the function is rotate_y but I think you want

$TwistPivot.rotation.y = twist_input

Thank you!! That did help in getting the mouse recognized, but it seems like it is constantly re-centering the camera. Again, this wan’t happening on my previous game which did not have a rotating sphere as the movable character. Any idea what might be causing it?

I misunderstood your script, you store a twist_input variable but don’t use it for accumulation. You could remove this variable and directly apply the rotate from event

func _unhandled_input(event: InputEvent) -> void:
		if event is InputEventMouseMotion:
			if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
				$TwistPivot.rotation.y += - event.relative.x * mouse_sensitivity
				pitch_input = - event.relative.y * mouse_sensitivity

But going back to rotate_y(twist_input) will work fine.

Well, that completely fixed it. I can’t believe it was such a specific syntaxe error. Thank you so much for your time and knowledge!!

It was the function name, rotate_y() is correct, but rotation_y() is incorrect.

however there is a variable that stores the accumulated rotation named rotation which has variables for each axis, x/y/z. I was confused because I normally opt to edit rotation over using the rotate functions, bad assumption on my part that you would want the same