Some basic questions

SiWi
Posts: 9
Joined: Sat Aug 23, 2008 1:36 pm

Some basic questions

Post by SiWi »

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?
-There are different functions to apply force and impulse, e.g. applyImpulse and applyCentralImpulse. What is the difference between those two. And what cords are the supplied vector arguments relative to? Are they relative to the world coords, or the RigidBody's local force.
-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?
-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. 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?

Thank you for your help in advance,
Simon. :D
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Some basic questions

Post by sparkprime »

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).
SiWi
Posts: 9
Joined: Sat Aug 23, 2008 1:36 pm

Re: Some basic questions

Post by SiWi »

Ok, so I've got some more questions:
-I've got a ragdoll and I set the Gravity of each of it's parts to 0,0,0.
Why would the Ragdoll start to spin away in some wierd way then?
Shouldn't it just stand still?
-How would you do something before and after every internal simulation step? Is there a sepcial callback that gets called whenever a simulationstep starts or ends?

Again, thank you for your help.
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: Some basic questions

Post by Dirk Gregorius »

The ragdoll parts might be slightly penetrating and/or constraints might be violated in the default setup. Set the Baumgarte term in the solver settings to zero and check if this makes a difference.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Some basic questions

Post by sparkprime »

is that the "Erp" one?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Some basic questions

Post by Erwin Coumans »

-I've got a ragdoll and I set the Gravity of each of it's parts to 0,0,0.
Why would the Ragdoll start to spin away in some wierd way then?
Have you tried (and compared with) the ragdoll provided in Demos\RagdollDemo\RagdollDemo.cpp or Demos\GenericJointDemo\GenericJointDemo.cpp?

There are many ways to create an instable ragdoll. Which constraints do you use? Did you make sure to disable collisions between attached limbs? Did you make sure to make the limbs sufficiently large? Increase the inertia tensor?
-How would you do something before and after every internal simulation step? Is there a sepcial callback that gets called whenever a simulationstep starts or ends?
Yes, you can assign an internal tick callback, using setInternalTickCallback. See Demos\CharacterDemo\CharacterDemo.cpp for an example how to use this tick callback.

Hope this helps,
Erwin
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: Some basic questions

Post by Dirk Gregorius »

Yes, iirc erp1 is for the normal error correction (like e.g. in joints) and erp2 is for the split impulse which is only used for contacts (last time I had a look)...
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Some basic questions

Post by sparkprime »

Am I right in assuming that split impulse is only for dynamic/dynamic collisions and not static/dynamic collisions? Also, what's the split impulse threshold for?

Sometimes with split impulse turned on, if there is a lot of weight on a body it will tunnel into the ground. This is noticable with a tall stack for instance.
SiWi
Posts: 9
Joined: Sat Aug 23, 2008 1:36 pm

Re: Some basic questions

Post by SiWi »

Well I'm actually using the setup from the ragdolldemo for the ragdoll.