Sign in to follow this  
jonnys

Collision Detection

Recommended Posts

I'd like to know how to implement bounding boxes and bounding spheres for loaded .ms3d models. Also i'd also like to get camera world collision (as in a first person camera colliding with objects in the world) so if there's anybody out there that can gimme a bit if help with that in any way possible it would definitely be appreciated.

Share this post


Link to post
Share on other sites
I would say just use a bounding sphere. For that, I would compute the centroid of the model by averaging all of it's points. Then, I'd compute the sphere radius by finding the maximum distance to the centroid.

Then you can have the model centered at the origin by subtracting the centroid from all points. That will make it easier to position for drawing.

Then for collision detection, just check if the sphere's distance from your triangles is less than or equal to the radius of the sphere. I'd probably just cast a bunch of random rays out from the sphere's center and see how long it takes them to hit the triangles. If you cast them out and they have a speed of 1, the time it takes for them to hit a triangle is the distance to it (d = rt, r = 1, d = t). I would use Moller Trumbore for this. They have posted code that works.

Mike C.
http://www.coolgroups.com/zoomer/


Quote:
Original post by jonnys
I'd like to know how to implement bounding boxes and bounding spheres for loaded .ms3d models. Also i'd also like to get camera world collision (as in a first person camera colliding with objects in the world) so if there's anybody out there that can gimme a bit if help with that in any way possible it would definitely be appreciated.


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this