How can I animate the movement of a sphere to a specific position? I already have the position mapped


Hi @Giovanni_Insfran,

To animate between two known positions, you can use the pc.Vec3 lerp method to smoothly transition between two vectors:

Or a more elaborate way is to use the PlayCanvas tween library:

Just make sure to use rigidbody.teleport() on dynamic objects.

Otherwise if you are talking about applying a constant force to push the body towards a direction, your applyForce() line is correct. Just make sure to do that in your script update method, so it’s applied over several frames.

Otherwise if you are looking in applying a momentary force (impulse), use applyImpulse() instead.

Hope that helps.


Thank you ! I appreciate your time :star_struck: