#How to Set node Rotation on local axis to a Specific Angle

1 messages · Page 1 of 1 (latest)

stray terrace
#

I am trying to create a camera movement system, however I want to limit how far up or down your camera can move. It mostly works, however I don't know how to snap the camera's rotation to fit the limit when it goes over it. I've been trying to look over godot documents, but have been having lots of trouble with basis stuff and matrix multiplication. If possible, I would also like to know how to calculate the angle/basis of a rotate_object_local() without applying it to the object, so I could read it and only apply it if necessary, although this is not necessary. Any help would be appreciated.

low hull
#

To constrain rotation on an axis, you can use something like cameraMount.rotation.x = clampf(cameraMount.rotation.x, -maxPitchRadians, +maxPitchRadians),
where maxPitchRadians could be defined like var maxPitchRadians := deg_to_rad(75.0)