fix a stupid bug in line/sphere collision code (was using sqrt where it shouldn't)
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 7 Oct 2005 12:56:54 +0000 (12:56 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 7 Oct 2005 12:56:54 +0000 (12:56 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5731 d7cf8633-e32d-0410-b094-e92efae38249

collision.c

index 30f4d76..4dc31a9 100644 (file)
@@ -1097,7 +1097,7 @@ float Collision_ClipTrace_Line_Sphere(double *linestart, double *lineend, double
        if (deviationdist > sphereradius*sphereradius)
                return 1; // miss (off to the side)
        // nudge back to find the correct impact distance
-       impactdist += (sqrt(deviationdist) - sphereradius);
+       impactdist += deviationdist - sphereradius;
        if (impactdist >= linelength)
                return 1; // miss (not close enough)
        if (impactdist < 0)