impulse

Started by
4 comments, last by MrRowl 18 years, 5 months ago
just about all of the static collision response ive seen work like this 9more or less) 1. get orthagonal component of objects velocity to intersecting plane 2. add the -orth velocity to the objects velocity, in effect causing the velocity along the normal of impact =0 3. find out how far the object 'accidentially' intersected the plane 4. move the object out of the plane onto its correct position 'onto' it. i want to model collision response based on forces, but im having a major issue. according to my understanding, when a mass impacts the ground, a normal force / impulse acts upon it keeping it from falling through the floor polygon. this impulse force is calculated by taking the time derivative of momentum which is added to the force of the object; this way the impulse force pushing back up on the object is equal to the force the object exerts on the ground. in my engine i have impulse = dP/dt. because of this force, the object stop's moving. now, my problem is this: to calculate dP/dt, i need to know how mdV. the velocity, however, wont change until there is an impact. but in order to cause an impact, i need the velocity to change? how can i exert a normal/impulse force on the object to change its velocity if that force requires the velocity has changed to evne exist?
"a low level aho master like you couldn't kill me even if I let you"
Advertisement
You might want to check out Danny Chapman's impulse-based Jiglib demo, including an earlier version with source code. Also see the paper and slides in the second link (use google to find the slides; link broken). His demo also includes basic cars that you might find helpful (tire model is simple: a good starting point).
very awesome links++
"a low level aho master like you couldn't kill me even if I let you"
haha, thanks again.

i fully got impulse only based collision detection and response working in both my game and my friends game. =) productive afternoon. the site's description was very straight forward. in case anyone else wanted to also do it, here is the excerpt i followed:

Per Timestep
1. Get all forces acting on the bodies.
2. Integrate velocity using the forces. Use the new velocities integrate positions.
3. Detect collisions & calculate impulses (ideally a swept test from old positions to new ones...
4. Restore positions and velocity to their original values.
------

From there, I just added the impulse force to the all the other forces acting upon the bodies and did the integration over. it works great! This guy, however, goes on a little more complex route to be able to stack objects, etc.

5. Process all collisions and constraints using impulses, iterating a few times over the list. These impulses update the velocities, but not the positions, of course.
6. Integrate the velocities (again) using the forces.
7. Process all collisions and constraints using impulses again, except now treat all collisions as inelastic, iterating a few times over the list.
8. Do a "shock" step - This allows objects to stack up even when the number of iterations in the previous steps is small.
9. Integrate the positions using the new velocities.




its very methodological so its not bad at all to do.
"a low level aho master like you couldn't kill me even if I let you"
Quote:Original post by Uthman
very awesome links++


Danny posts on this forum as MrRowl. More information here.
Scrap the shock step. It only worked because I implemented it wrong :)

This topic is closed to new replies.

Advertisement