[ODE] Ray-trimesh bugfix

Joe Ante joe at uti.is
Fri May 21 02:11:21 MST 2004


Hi,

Can someone check this into cvs.

The fix is actually checking the result of Collider.Collide because with
some Opcode Collider settings Opcode returns false but doesn¹t update the
cache since you are not expected to access the values anyway.

--- 
/Users/joachima/Desktop/unity/External/ode/ode/src/collision_trimesh_ray.cpp
Mon Apr 19 23:48:49 2004
+++ 
/Users/joachima/Desktop/Ode/oldode-040513/ode/src/collision_trimesh_ray.cpp
Sun May 16 16:28:24 2004
@@ -64,12 +64,13 @@
 
        /* Intersect */
        Matrix4x4 amatrix;
-       Collider.Collide(WorldRay, TriMesh->Data->BVTree,
&MakeMatrix(TLPosition, TLRotation, amatrix));
+       int TriCount = 0;
+       if (Collider.Collide(WorldRay, TriMesh->Data->BVTree,
&MakeMatrix(TLPosition, TLRotation, amatrix)))
+               TriCount = TriMesh->Faces.GetNbFaces();
 
-       /* Retrieve data */
-       int TriCount = TriMesh->Faces.GetNbFaces();
+       if (TriCount == 0)
+               return 0;
 
-       if (TriCount != 0){
                const CollisionFace* Faces = TriMesh->Faces.GetFaces();
 
                int OutTriCount = 0;
@@ -118,6 +119,4 @@
                        }
                }
                return OutTriCount;
-       }
-       else return 0;
 }


Joe Ante




More information about the ODE mailing list