You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This method uses the rigid body's ``angular_velocity`` property to rotate the body. It first calculates the difference between the current and desired angle and then adds the velocity needed to rotate by that amount in one frame's time.
76
-
77
-
.. note:: This script will not work with rigid bodies in *character mode* because then, the body's rotation is locked. In that case, you would have to rotate the attached mesh node instead using the standard Node3D methods.
80
+
This method uses the rigid body's ``angular_velocity`` property to rotate the body.
81
+
The axis to rotate around is given by the cross product between the current forward direction and the direction one wants to look in.
82
+
The ``clamp`` is a simple method used to prevent the amount of rotation from going past the direction which is wanted to be looked in,
83
+
as the total amount of rotation needed is given by the arccosine of the dot product.
84
+
This method can be used with ``axis_lock_angular_*`` as well. If more precise control is needed, solutions such as ones relying on :ref:`class_Quaternion` may be required,
0 commit comments