Physics mouse impulse -

As @musikai said, use mathutils instead of numpy if you can. You don’t need to use any arctan calculations to get euler angles to align to a vector, instead you can simply do own.worldLinearVelocity to get the mathutils vector object that is pointing towards your current linear velocity.

Using that, you can simply use alignAxisToVect to align to that vector, or alternatively use quaternion interpolation (slerp) which will give you a smoother rotation than alignAxisToVect (in my experience at least). I’ve attached an example for slerp below (it’s made for UPBGE 0.2.5, but the code should work in any version I think)

Generally, you want to avoid using euler angles whenever you can because gimbal lock can cause wacky issues, but sometimes it’s unavoidable.

rotateQuatExample.blend (725.7 KB)

1 Like