I’m making a 2D platformer but you can rotate to move on the z axis in 3d. Part of what I would need is to detect the rotation of the character to move on the z axis when facing in that direction.
The code I’m using to rotate and try detecting it looks like
func _physics_process(delta: float) -> void:
#rotation script
if Input.is_action_just_pressed("Turn Left"):
player.rotate_y (90*PI/180)
if Input.is_action_just_pressed("Turn Right"):
player.rotate_y (-90*PI/180)
if player.rotation_degrees == Vector3(0, 0, 0) or Vector3(0, PI, 0):
print("test")
but even though the player and children rotate, the second script keeps printing “test”, even after also trying to detect the rotation of the camera_3d node. Does anyone know why this happens and any possible fixes?