]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fixed up a number of nudging bugs in Collision_TraceLineTriangleFloat
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 21 Dec 2004 16:51:43 +0000 (16:51 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 21 Dec 2004 16:51:43 +0000 (16:51 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4876 d7cf8633-e32d-0410-b094-e92efae38249

collision.c

index af051b98e55f034365b5966c2a4df9cc4846308b..c0b930675d39a8fd25e8546ec75feadab38e1d90 100644 (file)
@@ -1478,13 +1478,13 @@ void Collision_TraceLineTriangleFloat(trace_t *trace, const vec3_t linestart, co
 
        // store the new trace plane (because collisions only happen from
        // the front this is always simply the triangle normal, never flipped)
+       VectorNormalize(faceplanenormal);
        VectorCopy(faceplanenormal, trace->plane.normal);
-       VectorNormalize(trace->plane.normal);
        trace->plane.dist = DotProduct(point0, faceplanenormal);
 
        // calculate the normalized start and end distances
-       d1 = DotProduct(faceplanenormal, linestart) - faceplanedist;
-       d2 = DotProduct(faceplanenormal, lineend) - faceplanedist;
+       d1 = DotProduct(trace->plane.normal, linestart) - trace->plane.dist;
+       d2 = DotProduct(trace->plane.normal, lineend) - trace->plane.dist;
 
        // calculate a nudged fraction to keep it out of the surface
        // (the main fraction remains perfect)