Collision detection for 3D objects

Started by
2 comments, last by Justice LeprechauN 17 years, 6 months ago
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.
There is nothing that can't be solved. Just people that can't solve it. :)
Advertisement
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
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.
-----BEGIN GEEK CODE BLOCK-----Version: 3.12GCS/M/S d->+(++) s+: a19? C++++ UL++ P+++ L+ !E W+++ N+ o++ K? w!O M-- V? !PS PE Y+ PGP t++ 5+++ X R tv+> b+(++)>+++ DI+++>+++++ D++G e>++++ h! r y?------END GEEK CODE BLOCK------
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.

This topic is closed to new replies.

Advertisement