Sign in to follow this  
DesignerX

Collision detection for 3D objects

Recommended Posts

I have a flat n' round 3D object, which can move only on the xz plane. In its way are low walls which block its path. I'm using DirectX 9 with C++. Can someone plz direct me or tell me how can I use DirectX utilities for detecting collision between the flat round object and between the game walls ? All objects (walls and disc) are Meshes loaded from an X file. thx.

Share this post


Link to post
Share on other sites
Well, this might not answer your question, but...

... if the object is round and flat (you mean like a hockey puck?), it seems unnecessary to use "real" collision detection.

I would think about using something like pythagoras theorem (especially since it only moves along x and z), and simply check if the "puck" is close enough to a wall to actually touch it, and thus colliding.

I guess you'll have to figure it out, and this is just an idea.

The way I see it, "real" collision detection does consume CPU power, and that seems unnecessary in this case.

But do consider that I'm not an expert. I do apologize if I'm talking bullshit.

/Justice

Share this post


Link to post
Share on other sites
Actually, you just described a real collision detection. It's just a very specific type (ie: cylindrical object on walls).

If the walls are all straight, you'll want to use the line equation, and find the nearest point on the wall(s), then see if (x2-x1)(x2-x1) + (z2-z1)(z2-z1) is more than the square of the radius of your "flat n' round" object (ie: r*r). Doing so, you don't have to use square root, and your detection will be considerably faster.

Share this post


Link to post
Share on other sites
Yes, yes, of course it's a "real" collision detection - or else it wouldn't work. :P

What I meant to express what that you don't need stuff like triangle selectors and such.

I mean, it's not really checking if 2 triangles are colliding, but actually if they are close enough to collide. :P
But, but, ok, might be a question of "point of view". Just wanted to be clear.

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