Sign in to follow this  
Red Shark

Is there a way to resolve collisions using MPR / XenoCollide?

Recommended Posts

Red Shark    114
I've spent the past two weeks mucking around with collision detection in my spare time. Unfortunately, I'm not sure that I'm even half-way to a fully robust solution, yet.

What I [i]do[/i] have, is a working collision detection system - I've implemented a version of [url="http://xenocollide.snethen.com/"]XenoCollide[/url]/ [url="http://en.wikipedia.org/wiki/Minkowski_Portal_Refinement"]Minkowski Portal Refinement[/url], and it is working acceptably well -- but at this point, all it's doing well is detecting.

I'm not looking to implement real physics, just to prevent objects from intersecting each other, so I was aiming for an update loop along the lines of this:[list=1]
[*]Add object position + velocity.x, and test that new value for collision.
[*] if collision detected, subtract a value from Velocity.x so that the objects are touching instead of intersecting.
[*]repeat step 1 & 2 for Z-axis.
[*]repeat step 1 & 2 for Y-axis.
[*]Add velocity to position.
[/list]
It's that 2nd half of step 2 that I'm struggling with -- is there a way to use my MPR code to figure out how far along the axis I need to back track? Right now I'm getting a contact normal (i.e., the direction I need to adjust the velocity), but I can't figure out how to use that to calculate the appropriate distance.

Is there a way I can use MPR to calculate the appropriate offset to prevent the collision? Since I can guarantee that the two objects are colliding, is there another algorithm I can use to solve for the new positions of 2 convex polyhedra? (Cubes for now, but I'd like to be able to do arbitrary convex shapes)

Any help or feedback would be appreciated!

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