Archived

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

BSP collision detection, using brushes.

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

I am currently trying to implement some test Collision Detection into my simple 3d engine using BSP brushes. I looked at Nathan Ostgard''s Q3 Collision tutorial. I have decided i first try a sort of copy-n-past approach to see if i can get something to happen, and then break it apart and build own functions... But what i really want to ask is if you have any thought of how i would make a good structure, where to put the CD-test and such. I have a camera class, and i have thought about putting it in there, though it dosn''t feel quite right...the CD shouldn''t been tied to a client camera, right? I have also thought about putting it in the BSP class...but that feels restricted too... It''s hard to post code for you to view...it is too large (and too ugly) So, any thoughts or advices?

Share this post


Link to post
Share on other sites
You''re right, the CD shouldn''t be integrated with the camera. Ideally, your collision detection should be abstracted, so that it can be used with anything - your camera, the player, projectiles, etc. I''m not sure how your code is set up, but I''d make a new class or struct that handles collision data. One way to do it would be to have separate classes for your bounding volumes (spheres, AABBs, etc.) and work with those.

Share this post


Link to post
Share on other sites
Thanks for the reply!

Yeah, i thought of making a class for collision detection, though abstract?
I were thinking of a global class so i can just send a bounding box/ray/sphere and a brushes/objects to a function.

I am still a bit unsure on how to arrange this. It would be easiest to call the CD class from for example the camera. If it moves i check if a CD occured with the the world/objects.

As my code is right now, the camera, players and basically all models inherit from an Object class, wich keep a set of vectors(position, up, right and front), a draw, and functions for loading/unloading. I could make a CD function that go through all objects, check their BBs and takes apropriate action if something has collided with something. But that would result in a great deal of checks, no?

Share this post


Link to post
Share on other sites