From 3068865a6c8f9624d816e17db6931b22943c8bd7 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Mon, 20 Aug 2018 11:42:28 -0700 Subject: [PATCH] fix MyAvatar collision bug at transitions b/w meshes --- libraries/physics/src/PhysicsEngine.cpp | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/libraries/physics/src/PhysicsEngine.cpp b/libraries/physics/src/PhysicsEngine.cpp index ef8c28bdc6..3837cee7a8 100644 --- a/libraries/physics/src/PhysicsEngine.cpp +++ b/libraries/physics/src/PhysicsEngine.cpp @@ -28,24 +28,6 @@ #include "PhysicsLogging.h" -static bool flipNormalsMyAvatarVsBackfacingTriangles( btManifoldPoint& cp, - const btCollisionObjectWrapper* colObj0Wrap, int partId0, int index0, - const btCollisionObjectWrapper* colObj1Wrap, int partId1, int index1) { - if (colObj1Wrap->getCollisionShape()->getShapeType() == TRIANGLE_SHAPE_PROXYTYPE) { - auto triShape = static_cast(colObj1Wrap->getCollisionShape()); - const btVector3* v = triShape->m_vertices1; - btVector3 faceNormal = colObj1Wrap->getWorldTransform().getBasis() * btCross(v[1] - v[0], v[2] - v[0]); - float nDotF = btDot(faceNormal, cp.m_normalWorldOnB); - if (nDotF <= 0.0f) { - faceNormal.normalize(); - // flip the contact normal to be aligned with the face normal - cp.m_normalWorldOnB += -2.0f * nDotF * faceNormal; - } - } - // return value is currently ignored but to be future-proof: return false when not modifying friction - return false; -} - PhysicsEngine::PhysicsEngine(const glm::vec3& offset) : _originOffset(offset), _myAvatarController(nullptr) { @@ -88,9 +70,6 @@ void PhysicsEngine::init() { // in order for its broadphase collision queries to work correctly. Look at how we use // _activeStaticBodies to track and update the Aabb's of moved static objects. _dynamicsWorld->setForceUpdateAllAabbs(false); - - // register contact filter to help MyAvatar pass through backfacing triangles - gContactAddedCallback = flipNormalsMyAvatarVsBackfacingTriangles; } }