Jump to content
xisto Community
sparkx

Checking For Plane Intersection.

Recommended Posts

Hello everyone. I am new to C++ game programming but I know so much already. I use 3D game programming in C++ at the moment. I was just wondering what the easiest way to check if two objects intersect in planes. Lets say I have two cubes with the sides of 5. My GL would be based off of float var x. Every vertex would be (x,x,x),(x,+5,x) est. Now to keep it simple I will assume that they are 2D not 3D. Here is an example of what my vertexes might be:1 (front only) 2 (front only)(0,5)(5,5) (-5,5)(0,5) (0,0)(5,0) (-5,0)(0,0)Up until now I have been running a long IF checking each side individually but this is long and doesn't work when I rotate my cube. What is the simplest way to check for plate intersection/collusion? I could set up a “while” statement for my current check, but first I want to check if anyone knows a better way.I don't know if any of that made since to you. Feel free to say so I will make it clearer. Basically I want to find the collusion point(s) (if it collides) so I can perform math based off of the collusion point.Thanks,Sparkx

Share this post


Link to post
Share on other sites

As far as I know of, DirectX do provide an interface "ICollidable", of which you can create a sphere or rectangular box as the bounding sphere/box. From there you can detect directly from the API if the 2 object overlap each other, or collide in this case.

I've found a sample chapter that explain a little bit more, but it's in C#. Introduction to 3D Game Engine Design Using DirectX 9 and C#

You can search for similar terms under GL at google

Share this post


Link to post
Share on other sites

Thanks, I think that link is broken. I found some good projects online but I think I will get the SB version 4 to go further. Has anyone used it yet? Is it a good book for C++ game programming? It is huge and costs a lot (for a book) I would like to get some oppinions on this. Or is it better to just use things posted on the web and sample projects. I was hoping to find a better way to test for collusion, afterall how do people that make big games get collusions for complex objects. Do they set up an array or is there a function that checks for collusion? It would seem crazy if they made all collusions by hand. I have found a few GREAT websites that have lots of content but they don't include some things I have been looking for.Thanks,Sparkx

Share this post


Link to post
Share on other sites

Thanks, I think that link is broken. I found some good projects online but I think I will get the SB version 4 to go further. Has anyone used it yet? Is it a good book for C++ game programming? It is huge and costs a lot (for a book) I would like to get some oppinions on this. Or is it better to just use things posted on the web and sample projects. I was hoping to find a better way to test for collusion, afterall how do people that make big games get collusions for complex objects. Do they set up an array or is there a function that checks for collusion? It would seem crazy if they made all collusions by hand. I have found a few GREAT websites that have lots of content but they don't include some things I have been looking for.Thanks,
Sparkx

Books usually is better, in the sense that everything is structured and easy to follow, and you can easily find sample for "ordinary" stuffs. But when you reach a level that you can handle most programming task, but just need to know how to do certain task(usually not ordinary ones), then books might bot be that helpful. I'm been facing that kind of problem. A while back, i need to write a program to display multiple video onto a few 3d surfaces, at the same time manipulate the surface's physical. No books give a good enough sample to reach what I wanted. So i resort to searching on the internet. But the obstacle is that you have to get the right keyword to search. Took me quite a while reading other's forum and sample, and then finally, got it working after a few months of research.

I have another site to recommend, http://gpwiki.org/. Just search for collision. They have forums and also a quite a lot of useful tutorial.

Good luck

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

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.