Whats the difference between setting rotation and angularVelocity of a rigidbody?,What the difference between setting angularVelocity and rotation of a rigidbody?
Whats the difference between:
rotation_ += angular_velocity_ x Time.deltaTime;
rb_.rotation = Quaternion.Euler(new Vector3(rotation_.x, rotation_.y, rotation_.z));
and
rb_.angularVelocity = angular_velocity_ x Time.deltaTime;
With my limited physics experience it seems the same? However the results are different, and the second one yields the right result. Why is this? and how can I use the first method correctly? Assume that I need to set rotation explicitly. Thanks for your help!
Edit: sorry about the repeated title, first time posting messed up the formatting
Answer by taelssyt · Dec 18, 2019 at 06:01 PM
@zacharytay1994 doing rb_.rotation is getting the object to spin at a fixed rate.. think of it like 5 degrees, 5 degrees, 5 degrees. while using the other method, you are compounding the speed of the angular change.
So using rb_.angularVelocity is getting the object to spin at a compounding rate.. think of it like 5 degrees, 10 degrees, 15 degrees.
If your goal is to make a wheel, you would want to use rb_.angularVelocity, because you are adding speed to the wheel, not directly setting the angle of it.
I was under the impression that rb.rotation was the orientation of the object, so if I set rb.rotation = {0,90,0}, the object would have orientation 90 on the x axis.
I'm not trying to make a wheel though, I want to explicitly set the orientation of an object through it's angular velocity represented in a vector3 form. I want to explicitly set the angle, how would I go about doing that?
What goes on behind the scene from setting rb.angularVelocity to Unity calculating rb.rotation?
Your answer
Follow this Question
Related Questions
In what way do units matter when providing density for Collider2Ds? 0 Answers
Hey I am trying to calculate velocity of a gameObject without using rigidbody 1 Answer
How to calculate correct angles for PID? 0 Answers
Oscillate object with forces/velocity 2 Answers
Calculating Torque Needed to Travel a Certain Distance Via the Magnus Effect 0 Answers