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

Quake collision detection

This topic is 5576 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

This has had me stumped know for over a week. And I seem to be getting more confused by the minute. What I can do is detect if a single point (player position) is in empty or solid space, I just can't do it for a ray segment or sphere without my program crashing. I'm just so confused on how to go about it. Note: I'm working on quake 2 collision detection, but my understanding is that quake 2 and quake 3 are very similar when it comes to this matter, so any comments regarding either are welcomed. Here is what I know: Each leaf in the bsp level may have a set of brushes within them. In the case of the bsp level itself (not accounting for any detailed or dynamic objects), when the player is in an empty space and the leaf flag variable is not solid space, there are no brushes stored in that leaf. I mention checking the leaf flag because there may be an invisible brush in empty space used for other things other then the polygons that make up the bsp level. Now when the player is in a leaf that's solid space, their always appears to be brushes stored in them. I was able to confirm this by testing the player position ever frame. All I did was first, check if the leaf flag was not solid, and then I tested if there were any brushes in that leaf. If both checks came up negative, then the player was in empty space. Now what's got me confused is, what's the purpose of checking the leaf brush sides when I already know if I'm in solid or empty space based on what I just outline? Other than for dynamic or detailed objects, I see no purpose checking them for collision detection. Before this, I thought I could just test the brush plane sides in that leaf against the a ray end point (were the player is trying to move to) or sphere radius for collision against the plane? But because there are no brushes in empty space until I move into a leaf that's solid, this will do me no good. So then how am I suppose to go about it? Do I send the ray or sphere through the entire bsp tree? And if so, how do I detect if the back leaf is solid. I ask this because from what I can tell, there are leaves on both sides of the nodes (front and back child). I have checked the cluster id to see if it was -1, but that seems like a waste of processing because I have to re-trace through the bsp tree again for each ray point. Anyone who has taken the time to add collision detection to their quake 2 or 3 bsp viewer and is willing to share some insight into this process, I'd greatly appreciate it. I can only image the pain you must have went through trying to add this feature because this is driving me nuts. [edited by - MagTDK on September 9, 2002 6:33:41 PM]

Share this post

Link to post
Share on other sites