Physics, Gravity, and Energy Accumulation

Post your questions, suggestions and experiences regarding to Image manipulation, 3d modeling and level editing for the Irrlicht engine here.
Post Reply
Alpha Omega
Posts: 288
Joined: Wed Oct 29, 2008 12:07 pm

Physics, Gravity, and Energy Accumulation

Post by Alpha Omega »

So I got some weird results working on my physics engine. Video is here.

http://www.youtube.com/watch?v=Vhyir9JiBbc

I am coding with the basic impulse equations (change in momentum impulse). As you can see at the beginning the boxes hit the edge of the cube and fall correctly but then they hit the bottom of the container and accumulate in the same spot and the gravity produces an energy accumulation in the system. How might I go about solving this? I thought I might have to use an energy damper but I still think either the penetration distance is wrong or something its very weird.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Post by Mel »

I'd say the accumulation is working more than it should... i don't know. In Havok, inside 3DSMAX, they use thresholds, and when an object is going to move less than the threshold, the object doesn't move at all, and i guess it also doesn't transfer any energy back to the system.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Alpha Omega
Posts: 288
Joined: Wed Oct 29, 2008 12:07 pm

Post by Alpha Omega »

Right now the interpenetration distance is solved every frame instead of holding an old position and reverting back. I tried this but it didnt seem to work very well since I have position updates in too many places. I also made a mistake by not placing the force accumulator as a part of the RigidBody class so simple vector additions could be resolved easily. Maybe this could have something to do with it but I should rewrite the engine from scratch after taking some advanced c++ lessons because I need better consolidation of the code to advance.
Post Reply