Move a Rigidbody by a specific certain amount in a smooth motion?

So I’m basically trying to get my character to push a block (rigidbody), however when I set it to go at a velocity and have it stop after a certain amount of time (via the WaitForSeconds() function), it doesn’t move the same amount each time. Using Vector3.Lerp with its position and smoothing it with Time.deltaTime also gives the same problem (not to mention, it has the block moving through other collisions when done this way).

Basically think of block-pushing in Zelda. How do I get it to move the same amount each time and move so smoothly too?

You could use Rigidbody.MovePosition together with Vector3.MoveTowards. MoveTowards does the same thing as lerp except it wont overshoot your target. Rigidbody.MovePosition will make sure that your block collides on its way.

Okay so I’ve managed to get a solution.
Basically, I get the position that the box started in (origin) and then the point I want it to go to (origin+distance). I make the box move at a fixed velocity, with no drag/friction whatsoever. When the box moves, it isn’t kinematic, and when it’s stationary, it is kinematic. I then check the distance that it has traveled from the origin and the distance between the box and its destination. I make two boundaries out of the two distances and when it is a small distance from the origin or has gone too far past it, then it will stop moving and be positioned at the destination. I’ve also used Raycasts to check if the box won’t be able to make the entire journey, so if not then it cannot be pushed/pulled.
There are other complexities that I have omitted for the sake of only saying the important parts but that is the general idea.

Thanks to Peaj for your ideas. :slight_smile: @Peaj