- Home /
Rigidbody move relative position ?
Ok I want to move a rigidbody along its local axis but I can't find the suitable command. For rotation and torque etc we have Rigidbody.AddRelativeTorque but I can't find the same for moving position ?
Comment
Best Answer
Answer by Bunny83 · Jan 16, 2012 at 12:48 PM
// local forward Force
rigidbody.AddForce(transform.forward * 5);
// local up Force
rigidbody.AddForce(transform.up * 5);
// local right Force
rigidbody.AddForce(transform.right * 5);
Ah brilliant I didn't know you could ad (transform) to AddForce ! $$anonymous$$any thanks Bunny83 :)
transform.forward is just a vector (the local z-axis in world-space). But since there is AddRelativeForce you might just use this one ;)
Answer by Eric5h5 · Jan 16, 2012 at 01:11 PM
Rigidbody.AddRelativeForce.
Was this always available? I can't find it in any release notes, so was it there all the time?
I used Rigidbodies just a few times and never was in need of this function.
Anyway +1