• Advertisement

Precision Problems with bouding sphere

Recommended Posts

I tried to make two spheres with bounding sphere to detect collision so they stop when they collide. But it seems that im having a precision issue. They stey stuck together because of small decimal keeping it stuck. Is there a way around this? Since they are in a 3d space, adding or subtracting a little off seems impossible and expensive. How can I solve these precision issues?


The code I used.

oldleftright = leftright, oldupdown = updown;

    leftright += 0.0001;
    leftright -= 0.0001;
    updown -= 0.0001;
    updown += 0.0001;

collide = test.Intersect(test2);
if (collide)
    leftright = oldleftright;
    updown = oldupdown;
collide = false;


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

  • Advertisement