Archived

This topic is now archived and is closed to further replies.

EnDoX

Bang head against wall with this Collision Detection

Recommended Posts

Hi all In normal circumstance I would try and avoid taking up all your time on this subject matter but I am getting more and more frustrated with collision detection in the IBSP format for Quake 3. I have been following the tutorial by Nathan Ostgard and this helped me amazingly with the understanding of BSP trees but i am seriously stuck on collision detection and have been working on this for ages. Ok, i have been trying to make the ray trace from the first section of the tutorial go from the cameras current position (using its vector) and the vector for where it is about to go. If the collision detection function says its hit something then it returns true else it returns false. So far it is detecting no collisions at all. I know that that a bool is not what its meant to return but i just want it to register a collision before i do any more code. I have been following the tutorial code very carefully and i have no idea why on earth it is not working. One thing i did miss out since i can''t seem to resolve this problem is checking the Shader lump for the contentsFlag and running a bitwise AND on it to see if it is actually 1 or Solid, since this lump does not contain anything similar to the contentsFlag. I have been using a combo of Nathan Ostgard''s code and the code from GameTutorials.com, the BSP loader Part 3. I really want to get on with the project but this is REALLY holding me back. If anyone has any kind of working code they would be willing to show me, or have solved this problem or anything then it would be more then a great help. I have done hours of research into the collision detection for BSP3 and this is honestly my last resort. Yours just about sane, -EnDoX-

Share this post


Link to post
Share on other sites
You have to do more than just check for BOOL. You find the magnitude between two points. dx = x1-x2, dy = y1-y2, dz = z1-z2; magnitude = sqrt(dx*dx + dy*dy + dz*dz).

Now the head has a radius, but the wall has a fixed point. So if the magnitude of the new position is less than the radius of the head, you can''t move to the new position, you''ll have to roll the head to get the right effect.

Share this post


Link to post
Share on other sites