diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2005-08-08 21:08:42 +0400 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2005-08-08 21:08:42 +0400 |
commit | 29f06ad76e7c718425e61381c29aa1b985200d62 (patch) | |
tree | 9bde56dbc3bc61c2191f8d61ba862fbd207cd12b /extern/bullet | |
parent | 7f98c960b530782fd0a6d34a222a8cd8d80ff35b (diff) |
some more work on bullet raycast
Diffstat (limited to 'extern/bullet')
-rw-r--r-- | extern/bullet/Bullet/Bullet3_vc8.vcproj | 17 | ||||
-rw-r--r-- | extern/bullet/Bullet/NarrowPhaseCollision/RaycastCallback.cpp | 22 | ||||
-rw-r--r-- | extern/bullet/Bullet/NarrowPhaseCollision/RaycastCallback.h | 4 |
3 files changed, 25 insertions, 18 deletions
diff --git a/extern/bullet/Bullet/Bullet3_vc8.vcproj b/extern/bullet/Bullet/Bullet3_vc8.vcproj index 125b4b6e0b1..c2f3e70180f 100644 --- a/extern/bullet/Bullet/Bullet3_vc8.vcproj +++ b/extern/bullet/Bullet/Bullet3_vc8.vcproj @@ -4,6 +4,7 @@ Version="8.00" Name="Bullet3ContinuousCollision" ProjectGUID="{FFD3C64A-30E2-4BC7-BC8F-51818C320400}" + SignManifests="true" > <Platforms> <Platform @@ -277,6 +278,14 @@ > </File> <File + RelativePath=".\NarrowPhaseCollision\ManifoldPointCollector.cpp" + > + </File> + <File + RelativePath=".\NarrowPhaseCollision\ManifoldPointCollector.h" + > + </File> + <File RelativePath=".\NarrowPhaseCollision\MinkowskiPenetrationDepthSolver.cpp" > </File> @@ -429,14 +438,6 @@ > </File> <File - RelativePath=".\CollisionShapes\TriangleMesh.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\TriangleMesh.h" - > - </File> - <File RelativePath=".\CollisionShapes\TriangleMeshShape.cpp" > </File> diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/RaycastCallback.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/RaycastCallback.cpp index f27801d224b..418e0a7e241 100644 --- a/extern/bullet/Bullet/NarrowPhaseCollision/RaycastCallback.cpp +++ b/extern/bullet/Bullet/NarrowPhaseCollision/RaycastCallback.cpp @@ -16,17 +16,18 @@ RaycastCallback::RaycastCallback(const SimdVector3& from,const SimdVector3& to) m_from(from), m_to(to), m_hitFraction(1.f), - m_hitProxy(0) + m_hitProxy(0), + m_hitFound(false) { } - +#include <stdio.h> void RaycastCallback::ProcessTriangle(SimdVector3* triangle) { + - int hits_found=0; const SimdVector3 &vert0=triangle[0]; const SimdVector3 &vert1=triangle[1]; const SimdVector3 &vert2=triangle[2]; @@ -53,8 +54,11 @@ void RaycastCallback::ProcessTriangle(SimdVector3* triangle) // Add an epsilon as a tolerance for the raycast, // in case the ray hits exacly on the edge of the triangle. // It must be scaled for the triangle size. + if(distance < m_hitFraction) { + + float edge_tolerance =triangleNormal.length2(); edge_tolerance *= -0.0001f; SimdVector3 point; point.setInterpolate3( m_from, m_to, distance); @@ -65,6 +69,8 @@ void RaycastCallback::ProcessTriangle(SimdVector3* triangle) if ( (float)(cp0.dot(triangleNormal)) >=edge_tolerance) { + + SimdVector3 v2p; v2p = vert2 - point; SimdVector3 cp1; cp1 = v1p.cross( v2p); @@ -72,23 +78,23 @@ void RaycastCallback::ProcessTriangle(SimdVector3* triangle) { SimdVector3 cp2; cp2 = v2p.cross(v0p); + if ( (float)(cp2.dot(triangleNormal)) >=edge_tolerance) { m_hitFraction = distance; if ( dist_a > 0 ) { - m_hitNormalWorld = triangleNormal; + m_hitNormalLocal = triangleNormal; } else { - m_hitNormalWorld = -triangleNormal; + m_hitNormalLocal = -triangleNormal; } - hits_found = 1; + + m_hitFound= true; } } } } } - //return hits_found; - } diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/RaycastCallback.h b/extern/bullet/Bullet/NarrowPhaseCollision/RaycastCallback.h index 5dbffde4244..92dac112a36 100644 --- a/extern/bullet/Bullet/NarrowPhaseCollision/RaycastCallback.h +++ b/extern/bullet/Bullet/NarrowPhaseCollision/RaycastCallback.h @@ -27,8 +27,8 @@ public: BroadphaseProxy* m_hitProxy; //output - SimdVector3 m_hitNormalWorld; - + SimdVector3 m_hitNormalLocal; + bool m_hitFound; RaycastCallback(const SimdVector3& from,const SimdVector3& to); |