Terminal Velocity

Hello friends,

So I’m trying to get a movement system where I can rely on Codea’s collision detection and polygon system without actually using acceleration or gravity.

Ideally I’d be able to just adjust linear velocity of a dynamic body, and have what I’m moving around colide with other, kinematic bodies.

Failing that, I’d like to use applyForce, but with a terminal velocity, which doesn’t seem inherently possible in the engine… anybody have a way of cheating/implementing one of these methods?

-Fabulam Games

One way to implement terminal velocity is to set dampening based on velocity i.e.

body.damping = body.linearVelocity.len() / 10.0

This mimics the effects of wind resistance, in that the faster the body goes, the more it’s movement is dampened. This means that if you apply a finite amount of force eventually your object will reach a maximum velocity.

Sweet thanks! I think that’ll do it…

In my pushball game i apply a simpler solution to limit the velocity, and also apply a force consumes my player’s energy, so i dont want to waste it:

    -- make sure the player doesnt go too fast
    if self.body.linearVelocity:len() > self.maxSpeed then
        self.body.linearVelocity = self.body.linearVelocity:normalize() * self.maxSpeed