Sign in to follow this  
hegrec

Proper collision response in a 3D engine?

Recommended Posts

hegrec    100
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?

Share this post


Link to post
Share on other sites
Krohm    5031
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 [i]manifolds [/i]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 [i]damping[/i].

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. Edited by Krohm

Share this post


Link to post
Share on other sites
maxgpgpu    206
[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]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this