D3D Col. Detection

Started by
9 comments, last by mengha 18 years, 10 months ago
Sorry for bringing this toppic up because i'm sure it's been asked 100's of times over. VB6.0 D3D7 I'm just looking for the very-beginners tutoral on 3D collision detection. Right now i'm putting each and every plane in a bounding box and using collision detection very simular to 2D collision detection, but that just won't cut it in the long run (All slopes get rounded off to rectangle collision zones. if you walk 20 feet down a hill - you walk just horozontaly until you come to the end of the slope and THEN drop down like it's actualy a stair.) Thanks in advace for the 'Collision for dummies' link. BTW - they are planes of multiple points. Not split into triangles already and no curved surfaces to worry about.
Advertisement
Can you tell us more about the environment and the collision detection requirements? That is, is it terrain-based, indoor, outdoor; is the character humanoid, or maybe a vehicle; does it need to align with the surface or just keep from falling through it - that sort of thing.
Quake 1 style will do nicely. Indoor-outdoor combo, humannoid.
With regards to gravity, I'd think that the best thing to do is imagine a line extending downwards from the player, and find which polygon/plane it intersects first. Then find the point where it intersects (presumably by interpolation) and compare that point to the bottom of your character, moving the character downwards if necessary.

Many similar routines (eg. for sliding along a wall) can be generally described as extending a vector in the given direction, seeing what it hits, then determining where it hits it.
Yes, Kylotan, but a tutoral for how to do it?
You could try googling for 'line plane intersection' - there are about 700,000 results so I'm sure one of them is likely to be useful, although it's somewhat mathematical. (But then that's life when you make the move to 3D.)
I've already tried that, i get nothing but 2D examples, ect...

If you don't know where a tutoral is then why bother posting?
Because not everything can always be answered by a tutorial. I am trying at least to give you some hints, which at this point is better than anyone else has managed.
Someone on another forum was kind enough to provide me this link:

href=http://externalweb.exhedra.com/DirectX4VB/Tutorials/DirectX8/GR_Collision3D


It gets me in the ballpark, i just need to figure out how to make it so i can
use more than just triangles, allowing me to check collisions with pollygons
with any number of points (i'm sure i can figure that much out). (It's provided in C and VB6)
Beware: whoever wrote that obviously has a better grasp of maths than I do, but they seem blissfully unaware that comparing 2 floating point values for equality is usually a very bad idea. If you end up using that code, watch out for that.

This topic is closed to new replies.

Advertisement