- Home /
Rigidbody move position smoothly ? (Point and click with rigidbody) ?
I have 2 game objects, "A" and "B" for example. (Arb is the "A" rigidbody component) I'd like to move A in B.transform.position with rb.MovePosition (so if the objects collides it will stop or something). But with Arb.MovePosition (B.transform.position); it teleports. I'd like a Vector3.Lerp but with a rigidbody. Any tips ? Thanks for the help.
Answer by cod · Sep 18, 2015 at 12:56 PM
As you can see from the link below the question has already been answered
http://answers.unity3d.com/questions/375412/how-to-rigidbodymoveposition-to-players-position.html
Basically you get the normalized direcion from your object to the target and you move your object along this direction with a given speed, which is multipied to Time.deltaTime to get m/s instead of m/frame
Also be sure to select a proper interpolation method for your rigidbody, otherwise you are going to get strange jittering
http://docs.unity3d.com/ScriptReference/Rigidbody-interpolation.html
Hope this helps
Your answer
Follow this Question
Related Questions
MovePosition in Rigidbody Ignoring Y axis? 0 Answers
Rigidbody slightly intrudes another one while pushing it 1 Answer
Why is my Rigidbody child not moving with it's Rigidbody parent? 1 Answer
MovePosition not as precise as Translate with Kinematic rigidbodies (example unitypackage included) 1 Answer