Skip to main content
GameDev.net gamedev.net
🔒 Locked

Any good tutorials on basic 3d collision?

Started by DarkCybo1 Apr 2, 2005 at 8:48 PM 5 replies 1.4k views
Original Post
DarkCybo1
DarkCybo1
All the 3d collision tutorials I've been too, either just give me the source code and expect me to understand, or barely explain it and then leave me with questions. Are there *good* tutorials/guides on basic 3d collision?
Hey babe.
DarkCybo1
DarkCybo1
Okay, the move made sense.

But anyway, UGP seems to only gives out the source code with a small explanation inside the actual source code.
Hey babe.
Zakwayda
Zakwayda
One problem is that there are many different ways to do collision detection in 3D. Even for 'basic' collision detection, there are quite a few ways to go about it. Can you tell us anything about your application, i.e. what kinds of objects, how many, what sort of environment, what sort of feedback you need from the collision system, etc.? With that information, it would be easier to make specific suggestions.

Meanwhile, you might check out the articles section here on gamedev, if you haven't already.
DarkCybo1
DarkCybo1
I just want to do basic collisions with cubes. I will have a function that checks if a cube is colliding with another cube or the player. The function will be called upon each movement of an object, if it returns true and that there would be a collision, the object does not move that way.

It will be used for an extremely basic FPS (using stick figure images) in OpenGL.
Hey babe.
Zakwayda
Zakwayda
Quote:
I just want to do basic collisions with cubes. I will have a function that checks if a cube is colliding with another cube or the player. The function will be called upon each movement of an object, if it returns true and that there would be a collision, the object does not move that way.
Well, you're in luck then because the type of collision detection you describe is pretty easy. The following function tells you whether two axis-aligned bounding boxes are intersecting:

bool IntersectAABBs(const Vector3& min1, const Vector3& max1,				    const Vector3& min2, const Vector3& max2){    if (min1[0] > max2[0])        return false;    if (min1[1] > max2[1])        return false;    if (min1[2] > max2[2])        return false;    if (max1[0] < min2[0])        return false;    if (max1[1] < min2[1])        return false;    if (max1[2] < min2[2])        return false;	    return true;}

If you're not sure about the terms used, just google for 'AABB intersection', or check out some of the articles in the 'collision detection' section here on gamedev.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.