Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | JimmyJohn |
I need to rotate a rigidbody to a rotation using angular velocity. This is so I can rotate an object to the rotation of a VR controller. Currently what I am doing is taking the goal rotation and subtracting the current rotation. Since velocity is in Euler Angles, I have to convert the basis to Euler Angles using get_euler().
func _integrate_forces(state):
var goal_rotation = goal_transform.global_transform.basis.get_euler()
var current_rotation = global_transform.basis.get_euler()
var rotation = goal_rotation - current_rotation
state.angular_velocity = rotation
After rotating past a certain point the rigidbody starts spinning in the wrong way. How do I rotate a rigdbody to a rotation using angular velocity?