59 btStaticPlaneShape* planeShape = (btStaticPlaneShape*)planeObjWrap->
getCollisionShape();
61 bool hasCollision =
false;
62 const btVector3& planeNormal = planeShape->getPlaneNormal();
63 const btScalar& planeConstant = planeShape->getPlaneConstant();
67 convexInPlaneTrans = planeObjWrap->
getWorldTransform().inverse() * convexWorldTransform;
69 convexWorldTransform.getBasis() *=
btMatrix3x3(perturbeRot);
71 planeInConvex = convexWorldTransform.inverse() * planeObjWrap->
getWorldTransform();
73 btVector3 vtx = convexShape->localGetSupportingVertex(planeInConvex.getBasis() * -planeNormal);
75 btVector3 vtxInPlane = convexInPlaneTrans(vtx);
76 btScalar distance = (planeNormal.dot(vtxInPlane) - planeConstant);
78 btVector3 vtxInPlaneProjected = vtxInPlane - distance * planeNormal;
79 btVector3 vtxInPlaneWorld = planeObjWrap->
getWorldTransform() * vtxInPlaneProjected;
81 hasCollision = distance < m_manifoldPtr->getContactBreakingThreshold();
86 btVector3 normalOnSurfaceB = planeObjWrap->
getWorldTransform().getBasis() * planeNormal;
87 btVector3 pOnB = vtxInPlaneWorld;
102 btStaticPlaneShape* planeShape = (btStaticPlaneShape*)planeObjWrap->
getCollisionShape();
104 bool hasCollision =
false;
105 const btVector3& planeNormal = planeShape->getPlaneNormal();
106 const btScalar& planeConstant = planeShape->getPlaneConstant();
112 btVector3 vtx = convexShape->localGetSupportingVertex(planeInConvex.getBasis() * -planeNormal);
113 btVector3 vtxInPlane = convexInPlaneTrans(vtx);
114 btScalar distance = (planeNormal.dot(vtxInPlane) - planeConstant);
116 btVector3 vtxInPlaneProjected = vtxInPlane - distance * planeNormal;
117 btVector3 vtxInPlaneWorld = planeObjWrap->
getWorldTransform() * vtxInPlaneProjected;
124 btVector3 normalOnSurfaceB = planeObjWrap->
getWorldTransform().getBasis() * planeNormal;
125 btVector3 pOnB = vtxInPlaneWorld;
132 if (convexShape->isPolyhedral() && resultOut->
getPersistentManifold()->getNumContacts() < m_minimumPointsPerturbationThreshold)
140 btScalar radius = convexShape->getAngularMotionDisc();
142 if (perturbeAngle > angleLimit)
143 perturbeAngle = angleLimit;
146 for (
int i = 0; i < m_numPerturbationIterations; i++)
150 collideSingleContact(rotq.inverse() * perturbeRot * rotq, body0Wrap, body1Wrap, dispatchInfo, resultOut);
156 if (m_manifoldPtr->getNumContacts())
btConvexPlaneCollisionAlgorithm(btPersistentManifold *mf, const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, bool isSwapped, int numPerturbationIterations, int minimumPointsPerturbationThreshold)