How to rotate a rigidbody to a specific rotation - not over time but by a given (increasing) value?
So if the give value is 0 the rotation of the rigidbody is still the same as before, but if the give value is for example 1 the rotation is halfway of the target and half the new rotation. At a value of 2 the rigidbody rotation should reach it’s rotation target.
I didn’t found a method for this approach - is there one?
You want Quaternion.Slerp(from, to, t);
from and to are the rotations you want to go between.
t is the percentage of the way that you want to go.
- t = 0 stays at the from rotation
- t = 0.1 goes 10% of the way between them
- t = 0.5 goes halfway (50%)
Thanks for your answer but this seams to be what i was looking for.
I need to put the code into the Update method so using t = 0.1 (e.g.) will rotate the object smoothly to the target rotation. But what I need is that using t = 0.1 will rotate directly to 10% of the way between them - even in a Update method.
I want to control the progress of the rotation by a changing value.