- Home /
Advice controling speed of a rigidbody
Trying to understand how to best use rigidbody to set or changing an objects speed.
I see AddForce but appears takes a vector3.
I have defined a speed (float) for my object.
It appears if I want the velocity (vector3) of an object I should do AddForce (vector3).
This appears to mean I must convert my objects speed into a vector based on the objects orientation and then set AddForce.
Is this the way to do it? Ther must be an easier way where I can set the speed (float) I want and let Unity figure out the addforce vector?
if I want to go 70 in a car I push the gas pedal to go 70. If I then want to go 50 I ease up on the gas pedal. Nature takes care of my velocity (doesn't matter if I am level or going up or down hill :-) ).
Can I control an object the same way in Unity? Can I set its speed to a specific value and it should accelerate until its moving at that speed? If I set the speed lower have the object decelerate until it is at that speed?
Answer by rsud · Sep 10, 2012 at 12:29 AM
I think I found my answer.
transform.forward is essentially the unit vector of the direction/orientation of the GameObject, correct?
Your answer
![](https://koobas.hobune.stream/wayback/20220613080835im_/https://answers.unity.com/themes/thub/images/avi.jpg)