# Looking for some info on OBB Collision.

## Recommended Posts

Alright so I've spent the past 2 days trying to figure out OBB collision. It's doing my head in as I can't really find any posts/info on the subject. Most of the stuff I've found is broken or incomplete. If anyone has any half decent links / info on the topic please share :) I'll still post up how I wanted mine done anyway incase anyone can give me a hand. Alright so I'm making a small game framework using SDL/openGL with C++. I already have all the graphics stuff and what not done. I've created a simple Matrix class that I use for holding my images rotation and on screen position. I've also wrote a Vector2 class that pretty much is the same as C#/XNA Vector2 class. Everything works great no issues at all so far except for I'm stumped how to do OBB collision. So if I was to make a new class called Player and made him nice and simple. So lets say his images is a square and it rotates. Now lets say I made two of these and wanted to check if they collide while they are both on an angle of X how would I be able to use OBB to check to see if they collide. I'm not to fusses how it's written as I'll fix it up I just want to know how I can somehow create a check for it. Example:
//Yes this would be in a class but for an example of a function so I can understand how this works.

struct OBB
{
//Not sure what sort of values I'd need to store but I gather a position and
//Maybe a matrix?
};

bool CheckOBBCollision(OBB& box1, OBB& box2)
{
Check:
{
// return false if no collision
}
//return true if collision
}

Sorry if this is a bit of a length question I'm just getting frustrated with myself and making it harder. Thanks, Scott.

##### Share on other sites
Seach the internet and/or forum archives for 'obb sat' or 'obb separating axis theorem'; I would be very surprised if you weren't able to find some good references.

Note that the 2-d version of the SAT for OBBs is quite a bit simpler than the 3-d version (since there are only two axes per box and no cross-product axes, there's a total of only 4 axes that need to be checked rather than 15).

##### Share on other sites
Thanks for the reply. I searched for what you've said and come across a couple of things. Looking at something like An Oriented Bounding Box (OBB) Intersection Test (Sorry don't know how to make a hyper link on here) This just seems a really over complicated way of doing this?

In one of your posts on another thread you were talking about "oliii's tutorials" but I can't find much info on this in google. Is this something on gamedev someone has made?

Sorry for being a pain in the butt.

Scott.

[grhodes_at_work edit - I turned the quoted URL into a hyperlink]

[Edited by - grhodes_at_work on September 11, 2009 9:43:48 AM]

##### Share on other sites
Quote:
 This just seems a really over complicated way of doing this?
Nope, that's how it's done. (The alternative algorithms that I can think of right now are all even more complicated than that.)

Like I said though, the 2-d version is quite a bit less complicated. Also, the example code in the article you linked to is optimized, which makes the algorithm look more complicated than it really is.
Quote:
 In one of your posts on another thread you were talking about "oliii's tutorials" but I can't find much info on this in google. Is this something on gamedev someone has made?
oliii is a forum member who has made available some code and tutorials on the SAT. Try using the forum search rather than using Google directly, and you should be able to find some links.

##### Share on other sites
How can I find the tutorials he made - By looking at his page "http://www.gamedev.net/profile/profile.asp?mode=view&id=98449" if I click on the homepage from that link it just has a broken link?

code.
discussion.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628298
• Total Posts
2981890

• 9
• 9
• 11
• 10
• 10
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.20433461666107178, "perplexity": 806.6144333405335}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2017-47/segments/1510934805466.25/warc/CC-MAIN-20171119080836-20171119100836-00445.warc.gz"}