Sign in to follow this  

Continuous OBB or Ellipse vs triangle

This topic is 3563 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Which is generally quicker to sweep test against a triangle, an OBB or an ellipse? Looking at the ellipse article http://www.gamedev.net/reference/articles/article2426.asp, there seems to be alot of computation, so are OBBs generally quicker? (For some reason I can't find any continuous OBB vs static triangle resources) [Edited by - Rajveer on March 8, 2008 8:00:39 PM]

Share this post


Link to post
Share on other sites
Ok, I'm going to try to implement a continuous OBB-Triangle test. I know how to use the SAT for static OBBs vs tris but what about swept ones? Sweeping an OBB creates another shape of at most 12-sides, am I supposed to use the SAT with this shape or am I thinking about it wrong?

Share this post


Link to post
Share on other sites
I think I know what to do, for each possible separating axis I would project the triangle as usual, and then project the obb both before and after movement and combine its 2 ranges, then continue as usual right. But what if I want the deepest intersection depth so I can move the OBB that amount along the triangle's normal?

Share this post


Link to post
Share on other sites
Quote:
Original post by Rajveer
I think I know what to do, for each possible separating axis I would project the triangle as usual, and then project the obb both before and after movement and combine its 2 ranges, then continue as usual right. But what if I want the deepest intersection depth so I can move the OBB that amount along the triangle's normal?
The typical way to do this is to use the same axes and projections as in the static test, but perform swept rather than static interval-interval tests. Each interval test yields a 'first' and 'last' time of intersection. As you perform the tests, you track the greatest of the 'first times' and the least of the 'last times'; the interval you're left with tells you if and when an intersection occurred.

It's a bit complicated to explain in a forum post (it's also a bit tricky to implement correctly). I'd recommend checking out Dave Eberly's articles and code at geometrictools.com, or taking a look at oliii's tutorials. (You might also consider whether it would be easier just to use a preexisting collision detection or physics package.)

Share this post


Link to post
Share on other sites
When you say sweeping the interval test, do you mean projecting the OBB's current and future positions onto whichever axis I'm testing and combining their ranges?

Also, how is time calculated? For example say I'm testing in the triangle's plane:

- Project the triangle onto the normal, store triRange.min and triRange.max
- Project the current OBB onto the normal
- Project the future OBB onto the normal
- Find min and max of both OBB ranges, store as OBBRange.min and OBBRange.max
- Compare triRange and OBBRange, if no overlap then intersected

where would time of collision come in?

Share this post


Link to post
Share on other sites
I think I've nearly nailed the algorithm, all I'm having trouble with is calculating the time to first collision so I can actually position the OBB next to the triangle (time to last isn't important to me, unless I need to use it somehow without realising it!)

I think I also may have misunderstood you, can you explain how to calculate the intersection time/distance? I've drawn a (crappy) diagram showing what I'm doing, this shows the projection onto the triangle's normal axis. In this projection, the time to collision would be the initial OBBs minimum range - the maximum (or minimum, either in this case) range of the triangle. However this isn't always the case for other axes, so what am I doing wrong? What about the case where the range of the triangle is larger than both OBB ranges?

Image Hosted by ImageShack.us<br/>

[Edited by - Rajveer on March 11, 2008 9:18:08 AM]

Share this post


Link to post
Share on other sites

This topic is 3563 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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