Jump to content
  • Advertisement
Sign in to follow this  
NDraskovic

Collision detection not working properly

This topic is 2174 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 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
Advertisement
Seems to me the problem resides in the moving element. How do you keep track of the moving element's position?

Share this post


Link to post
Share on other sites
I think I solved the problem, I was moving the BoundingSphere twice faster than the model itself, so naturally it intersected with other Spheres twice sooner.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!