Apply* to body functions not working

Topics: Developer Forum, User Forum
Jul 21, 2009 at 8:42 AM

What am I missing?

I read whatever info there was in the manual & the API and from what I gathered all I have to do is body.ApplyImpulse / Force / Torque and it should show on the next loop.

Strangely, ApplyAngularVelocity & LinearVelocity does work.

Sorry if this is a stupid question, but I've been kinda stuck on this awhile.

 

Also, what is the difference between doing, say, ApplyTorque and ApplyAngularVelocity? Thanks a lot in advanced

Coordinator
Jul 21, 2009 at 4:50 PM

There are the following apply methods of interest:

* ApplyForce()
* ApplyTorque()
* ApplyImpulse()
* ApplyAngularImpulse()

ApplyForce and ApplyTorque both need large values. The Impulse versions does only need low values for something to happen.

ApplyTorque() applies a force to the bodys angular velocity. It is basically calculated and applied like this:

deltaVelocity = torqueAmount * inverseMomentOfInertia * deltaTime
angularVelocity = previousAngularVelocity + deltaVelocity

ApplyAngularImpulse() applies its amount directly to the angular velocity. It is calculated like this:

angularVelocity = angularVelocity + torqueAmount * inverseMomentOfInertea

 

Basically impulse is assumed to include the dt (delta time), so when you apply an impulse of 10, it would be the same as if you apply 1 force over 10 time units. Hopes that makes sense.

They all works fine, are you sure you are drawing the textures correctly? The bodies might change position in the physics engine, but you might not be drawing them right to see the changes take effect.