First you have to understand that when you call stepSimualtion(delta_time) there may be several "internal steps" that occur to fill the full amount of time given.
SiWi wrote:I searched the forum and read the manual as well as the faq, but I'm still unsure about these points:
-Impulse is force*time, right?
-Forces and impulses get cleared every time, right?
Impulses are the change in momentum during an internal step, and are cleared after.
Forces are the change in momentum during 1 second, and are cleared at the end of stepSimulation(delta_time).
You are meant to reapply forces between calls to stepSimulation, e.g. from your game logic or by processing player input.
-There are different functions to apply force and impulse, e.g. applyImpulse and applyCentralImpulse. What is the difference between those two.
apply forces between calls to stepSimulation
apply impulses between internal steps using an internal step callback
the "applyCentral" is just a version that is optimised for the case when no torque is involved.
And what cords are the supplied vector arguments relative to? Are they relative to the world coords, or the RigidBody's local force.
I think world, but I can't remember exactly.
-Just for clarity: What would you use to counteract global gravity, for example. Let's assume the world's gravity is 0,-10,0. Would you apply a central force of 0, 10, 0 every frame?
You can either do that, or just set the gravity of the rigid body. The gravity of the world is just the default rigid body gravity when you make new rigid bodies
-One last, more difficult question: I want to create some Matrix like effects. This means I have to slow down the simulation, of everything, but a few rigid body.
My approach would be to multiply the deltaTime given to stepSimulation with a multiplier, let's say 0.1.
This works, i've tried it myself
I would then get the non-slowed body's velocity every frame and set it again, after having it multiplied with the multiplier^(-1), in this case 10. Would that be the right approach?
Not every frame but every internal step.
I would actually slow the other bodies down, by changing their gravity, increasing their mass, and scaling their velocities (at the beginning and end of the bullet time sequence, not every frame). I think this should have the same effect. This way you don't end up with super-fast stuff flying around and the tunneling etc that would result, and you don't need to scale the delta_time (which is a pretty artificial technique anyway).