Jump to content
  • Advertisement
Sign in to follow this  
RunningInt

Bounding Box / triangle collision

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

Hi I am making a 3d engine where the world is made out of triangles (ie no such things as convex brushes, just trianges). I spent a while figuring out how to work out segment/triangle collisions, but now there is a bigger problem for me. The "player" is represented as an axis-aligned bounding box. So of course when the player moves, it needs to be able to detect a collisions with a triangle, and the point of that collision. Lets say there is a triangle and a bounding box, and a vector which that bounding box will move along. How can I determine whether the bounding box collides with the triangle over the course of that movement? And if it does collide how do I calculate the ratio along the movement vector that collision occured. I am completely stumped. Any idea or something to get me going will be very helpful.

Share this post


Link to post
Share on other sites
Advertisement
You can do this sort of collision detection using the separating axis technique. If your world is complex, you may also need a broad-phase step to cut down on the individual tests. If your world is not complex, you might look into AABB vs. BSP trees, which has been used for collision detection in countless games.

People have also had a fair amount of luck using ellipsoidal bounding volumes for this sort of thing. A good paper can be found here.

Regardless of which method you use, it may take some work to implement robustly, as most collision detection methods (including the above) have degenerate cases that must be handled, and are vulnerable to floating-point error.

Share this post


Link to post
Share on other sites
thanks for the advice! Think I will go along with the ellipse test

Quote:
Regardless of which method you use, it may take some work to implement robustly, as most collision detection methods (including the above) have degenerate cases that must be handled, and are vulnerable to floating-point error.


Yes one thing I have real trouble with is debugging 3D collision code. I am only too used to collision detection and response working for ages and then suddenly finding myself walking through a wall.

I end up having the program write to a log file each frame which I then have to scour over for hours till I find the error.

Share this post


Link to post
Share on other sites
i made exactly what you want to do.. player as box colliding with triangular geometry. the best and very simple solution is calculating minkowski sum of box and triangle and then intersecting ray with this volume.
works perfectly for me , still i have problems with collision reaction.
those minkowski sums can be cached so the cost of collision detection is mostly ray-multiple plane volume intersection test which is fast.
and minkowski sum of triangle and axis aligned cube is quite easy to calculate (it will be up to 17 planes

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!