Jump to content
  • Advertisement


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


Quake 2 collision detection

This topic is 5898 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Could someone explain the basics of how quake 2 does their collision detection. The way I''m trying to do it now is as follows: Note: this is a line of site detection algorithm. 1. I send a ray through the bsp tree starting with model[0] head node (model[0] is the main bsp tree, so this should be zero). The ray is nothing more then a starting point (player position) and ending point (were the player is trying to move to). 2. If both points end up on the node plane or in front the node plane then I send both (starting and ending points) down the front node. If the front node is less then zero then it must be in a leaf therefore empty space. 3. If both points of the ray end up behind the nodes plane then I send the ray down the node''s back child. Problem I have here is I don''t know how to tell if I''m in solid space. Is there a flag for this? My quick hack has me sending both points through my find_leaf_point_is_in function. From there I check that leafs cluster id data member. If the leafs cluster id is -1 then I''m in solid space. 4. The last possibility is both points may be spanning the plane. In this case I find the intersection point breaking the ray line up into two separate segments. From there I continue to send each segment down the bsp tree were one segment is sent down the nodes front child and the other is sent down the back child. 5. This recursively happens until either all ray line segments end up in empty (leaf) space in which the player can move into. Or if any one of these segments end up in solid space then the player is restricted from moving in that direction. Now this almost works, except that I get occasional errors crashing the program. From what I''ve read on other message post, quake 2 does it different but not enough explanation was presented. Other message posts talk about checking the brushes. But I am not sure what is meant by brushes in this case? I know each node has indices into the face array that are suppose to be used for collision detection, I am just not sure how. I''m not looking for anything fancy, just basic collision detection (if player hits solid space). From there I can work out things like sphere or ellipsoid collision detection. I would appreciate any help anyone can offer (like psuedo code or just an explanation)

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!