Proper collision response in a 3D engine?

Started by
1 comment, last by maxgpgpu 12 years, 1 month ago
Hello all, I am working on making a simple 3D Physics engine for rigid bodies, and have been wondering about the proper way to implement collision response, if there even is a proper way. As of right now, I have been simply doing the Hyperplane Axis Seperation test, and getting a "push" vector, and setting the position of entities to not penetrate the world or other entities. This has been working pretty well, but I was wondering if using impulse based responses would yield any better results, as some things seem to act funny. I guess my real question is, with full force integration applying gravity and all that stuff, is it possible to say, once you hit the floor in a map, apply an impulse to cancel out gravity without bobbing the player up and down, or is setting the position of the player the only real way to ensure a steady response without jittering?

Would using explicit position setting for entity-world collisions, and impulse based response for dynamic entity-entity collisions yield any better results?
Advertisement
You're embarking on a seriously difficult project. For sure, you need to somehow track some permanent informations about "almost there collisions": Bullet calls them manifolds and they're somehow used for stability improvements as well as performance AFAIK.
As far as I've understood, Bullet will use this information (together with impulse thresholds) to figure out when to just rest/sleep a certain object. I also suggest to look into damping.

As for your specific question, I'm afraid I cannot directly answer that but I find extremely scary the fact your physics would end up presenting different behavior for world and entities. Whatever this would be "better" or not I cannot tell but by sure it might end up giving diverging simulations; coherency is king. Think if you can allow that. I spent like 1 month in making this problem go away.

Previously "Krohm"

[font=georgia, serif]I'll mention just one dirty but accurate trick to consider to avoid jittering. Do not perform collision detection or collision response for any object that did not move or rotate since last frame. Jitter == gone. If your problem is that physics computations always end up with objects moving microscopically, and therefore always entering into collision detection and response computations, select a threshhold below which you simply set the object position (more or less "in contact") and set the object velocities and accelerations to zero [relative to the contact object], and then implement my first trick.[/font]

This topic is closed to new replies.

Advertisement