Search code examples
game-physicsrigid-bodies

moving physics body at a constant speed


I am working with a 2D physics engine that has the typical physics properties on a rigidbody

get/set mass, friction, bounce, gravity, linear damping, linear velocity, impulses.

I would like to move this rigidbody at a constant speed, is there some formula that I can use to uses those forces to move the body at a constant speed.


Solution

  • Constant speed can only be achieved in a universe with no other matter. So, you've got to remove friction(no air to bump into), gravity(no other mass pulling on the object to speed it up or slow it down), etc. It'll look very strange if those effects apply to every other object in the app but not this one.

    So... Set mass to 1(or some other appropriate value), set friction to zero, set gravity to zero, set linear damping to zero, set linear velocity to 1(or whatever number you'd like), set there to be no impulses.