From: havoc Date: Fri, 7 Oct 2005 12:56:54 +0000 (+0000) Subject: fix a stupid bug in line/sphere collision code (was using sqrt where it shouldn't) X-Git-Tag: xonotic-v0.1.0preview~4551 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a038c55b7cf69f173993a4301c653efc017657d8;p=xonotic%2Fdarkplaces.git fix a stupid bug in line/sphere collision code (was using sqrt where it shouldn't) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5731 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/collision.c b/collision.c index 30f4d766..4dc31a9d 100644 --- a/collision.c +++ b/collision.c @@ -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)