diff options
Diffstat (limited to 'extern/bullet/Bullet/NarrowPhaseCollision/ManifoldContactAddResult.cpp')
-rw-r--r-- | extern/bullet/Bullet/NarrowPhaseCollision/ManifoldContactAddResult.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/ManifoldContactAddResult.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/ManifoldContactAddResult.cpp new file mode 100644 index 00000000000..bb45e5215f3 --- /dev/null +++ b/extern/bullet/Bullet/NarrowPhaseCollision/ManifoldContactAddResult.cpp @@ -0,0 +1,33 @@ + +#include "ManifoldContactAddResult.h" +#include "NarrowPhaseCollision/PersistentManifold.h" + +ManifoldContactAddResult::ManifoldContactAddResult(SimdTransform transA,SimdTransform transB,PersistentManifold* manifoldPtr) + :m_manifoldPtr(manifoldPtr) +{ + m_transAInv = transA.inverse(); + m_transBInv = transB.inverse(); + +} + + +void ManifoldContactAddResult::AddContactPoint(const SimdVector3& normalOnBInWorld,const SimdVector3& pointInWorld,float depth) +{ + if (depth > m_manifoldPtr->GetManifoldMargin()) + return; + + + SimdVector3 pointA = pointInWorld + normalOnBInWorld * depth; + SimdVector3 localA = m_transAInv(pointA ); + SimdVector3 localB = m_transBInv(pointInWorld); + ManifoldPoint newPt(localA,localB,normalOnBInWorld,depth); + + int insertIndex = m_manifoldPtr->GetCacheEntry(newPt); + if (insertIndex >= 0) + { + m_manifoldPtr->ReplaceContactPoint(newPt,insertIndex); + } else + { + m_manifoldPtr->AddManifoldPoint(newPt); + } +}
\ No newline at end of file |