Sign in to follow this  

Collision detection not working properly

Recommended Posts

I have a really weird problem with my collision detection algorithm. I have a few static elements and one movable, and for now I just want to make the movable element stop when it collides with the static ones. I tried to solve this in 2 ways - by using BoundingSpheres that are created automatically for each mesh of the static elements (in this case, algorithm never returned the "true" value in the Intersect method, although the models obviously collide), and I tried creating independent BoundingSpheres with the same center as the models that I'm drawing. In this case I get some results (the Intersects method returns true value sometimes), but the routine I have is triggered at the wrong time. For example, there are 3 static elements in coordinates (-5.0f,0f,0f), (0f,0f,0f) and (5.0f,0f,0f). When I run the program there are 3 collisions (as they should be) but they all take place between the first 2 elements (but not exactly in front of them). The weirdest part is that in the same program I have a picking algorithm that works with the same BoundingSpheres perfectly (when I click the position where the BoundingSphere should be, the proper function is triggered). What could be causing this?

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