public void ProcessTriangle(Vector3[] triangle, int partID, int triangleIndex)
        {
            //aabb filter is already applied!
            CollisionAlgorithmConstructionInfo collisionAlgorithmConstructionInfo = new CollisionAlgorithmConstructionInfo();

            collisionAlgorithmConstructionInfo.Dispatcher = _dispatcher;

            CollisionObject collisionObject = _triBody;

            //debug drawing of the overlapping triangles

            /*if (m_dispatchInfoPtr && m_dispatchInfoPtr.m_debugDraw && m_dispatchInfoPtr->m_debugDraw->getDebugMode() > 0)
             * {
             *      Vector3 color = new Vector3(255, 255, 0);
             *      btTransform & tr = ob->WorldTransform;
             *      m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[0]), tr(triangle[1]), color);
             *      m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[1]), tr(triangle[2]), color);
             *      m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[2]), tr(triangle[0]), color);
             * }*/

            if (_convexBody.CollisionShape.IsConvex)
            {
                TriangleShape triangleShape = new TriangleShape(triangle[0], triangle[1], triangle[2]);
                triangleShape.Margin = _collisionMarginTriangle;

                CollisionShape tempShape = collisionObject.CollisionShape;
                collisionObject.CollisionShape = triangleShape;

                CollisionAlgorithm collisionAlgorithm = collisionAlgorithmConstructionInfo.Dispatcher.FindAlgorithm(_convexBody, _triBody, _manifold);

                _resultOut.SetShapeIdentifiers(-1, -1, partID, triangleIndex);
                collisionAlgorithm.ProcessCollision(_convexBody, _triBody, _dispatchInfo, _resultOut);
                collisionObject.CollisionShape = tempShape;
            }
        }
Example #2
0
        public BroadphasePair(BroadphaseProxy proxyA, BroadphaseProxy proxyB)
        {
            _proxyA = proxyA;
            _proxyB = proxyB;

            _algorithm = null;
            _userInfo  = null;
        }
Example #3
0
        public BroadphasePair(BroadphasePair other)
        {
            _proxyA = other._proxyA;
            _proxyB = other._proxyB;

            _algorithm = other._algorithm;
            _userInfo  = null;
        }
Example #4
0
        public BroadphasePair(BroadphaseProxy proxyA, BroadphaseProxy proxyB)
        {
            _proxyA = proxyA;
            _proxyB = proxyB;

            _algorithm = null;
            _userInfo = null;
        }
Example #5
0
        public BroadphasePair(BroadphasePair other)
        {
            _proxyA = other._proxyA;
            _proxyB = other._proxyB;

            _algorithm = other._algorithm;
            _userInfo = null;
        }
Example #6
0
        public CollisionAlgorithm FindAlgorithm(CollisionObject bodyA, CollisionObject bodyB, PersistentManifold sharedManifold)
        {
            CollisionAlgorithmConstructionInfo collisionAlgorithmConstructionInfo = new CollisionAlgorithmConstructionInfo();

            collisionAlgorithmConstructionInfo.Dispatcher = this;
            collisionAlgorithmConstructionInfo.Manifold   = sharedManifold;
            CollisionAlgorithm collisionAlgorithm = _doubleDispatch[(int)bodyA.CollisionShape.ShapeType, (int)bodyB.CollisionShape.ShapeType].CreateCollisionAlgorithm(collisionAlgorithmConstructionInfo, bodyA, bodyB);

            return(collisionAlgorithm);
        }