How do you controll momentum?

Say you know how a box slides across the floor when enough speed is applied? How do you just delete the momentum, so it comes to a sudden stop?

Better stated: How do you switch the momentum to a different direction???

Better yet: How do you control momentum? :evilgrin:hehehe…

The API has a number of physics/movement related functions such as:
object.applyForce()
object,applyTorque()
object.setLinearVelocity()
object.setAngularVelocity()
object.applyImpulse()

You can reverse an objects direction with:

from Mathutils import Vector

cont = GameLogic.getCurrentController()
own = cont.owner

velocity = Vector(own.getLinearVelocity())
own.setLinearVelocity(-velocity)

You can limit speed though:

from Mathutils import Vector

MAX_SPEED = 5.0

cont = GameLogic.getCurrentController()
own = cont.owner

velocity = Vector(own.getLinearVelocity())
if velocity.magnitude > MAX_SPEED:
    velocity.magnitude = MAXSPEED
    own.setLinearVelocity(velocity)

And you can slow an object down with:

from Mathutils import Vector

cont = GameLogic.getCurrentController()
own = cont.owner

velocity = Vector(own.getLinearVelocity())
velocity.magnitude /= 1.1
own.setLinearVelocity(velocity)

The mass of an object can be set in the logic panel in the physics setting or in python through object.mass.

Also note that momentum is velocity * mass, perhaps you are only after velocity?

Wow! great stuff!

But how can you bring an object to a sudden stop…the slow down scrips only slows the object, it doesn’t stop the object…

object.setLinearVelocity([0,0,0]), although a sudden stop is not very polished. I prefer the object to slow down over a number of frames, even if that be 10.