Sign in to follow this  
YZK

How to calculate the new move distance when two OBB box are collision?

Recommended Posts

The question is this: Suppose two OBB box: A,B A is still. B is move along Vector P, move distance is 10.0, and B hit A if not limit move distance of B , so we should find a new distance to avoid this. How to get it? Can get someting from 15 steps of seperate aixs test?

Share this post


Link to post
Share on other sites
if I understand your question correctly, then you need to use the momentum law.
if its an elastic collision then this should help you:
http://en.wikipedia.org/wiki/Elastic_collision

Share this post


Link to post
Share on other sites
Project both OBBs to the axis of P. From there it is easy to see how far apart A and B are in the direction of movement.

Share this post


Link to post
Share on other sites
Quote:
Original post by Vorpy
Project both OBBs to the axis of P. From there it is easy to see how far apart A and B are in the direction of movement.
I don't think that's right - the boxes could be oriented in such a way that their projections onto P intersect before the boxes themselves do.

@The OP: To find the first time of intersection you'll want to use a continuous or 'swept' version of the SAT.

Try googling 'swept separating axis test' or 'continuous separating axis test' for more info.

Share this post


Link to post
Share on other sites
Hmm...I don't know what I was thinking.

The swept separating axis test is definitely what's needed here. You compute the times at which the objects begin and end intersecting on each axis. The collisions happen after all the axes are intersecting, so the time that the last intersection begins is the time of collision. There is no collision if the latest intersection start time is greater than the earliest intersection end time.

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