22-09-2020, 03:11 PM
(22-09-2020, 03:03 PM)josemendez Wrote: No need . I'm assuming rotation changes only from one Update() to the next, that's why I'm diving by Time.deltaTime instead of Time.fixedDeltaTime.
Ok then I must be doing something wrong. There is my code attached to the object. No error in the console. I'm still getting the stutter I had.
Code:
void Update()
{
// get delta rotation (difference between current rotation and previous rotation)
Quaternion delta = transform.rotation * Quaternion.Inverse(prevRotation);
prevRotation = transform.rotation;
// get angular velocity from that:
angleVel = new Vector3(delta.x, delta.y, delta.z) * 2.0f / Time.deltaTime;
//print(angleVel);
transform.GetComponent<Rigidbody>().angularVelocity = angleVel;
}