Search in sources :

Example 1 with CollisionAlgorithm

use of spacegraph.space3d.phys.collision.broad.CollisionAlgorithm in project narchy by automenta.

the class ConvexTriangleCallback method processTriangle.

@Override
public void processTriangle(v3[] triangle, int partId, int triangleIndex) {
    // just for debugging purposes
    // printf("triangle %d",m_triangleCount++);
    // aabb filter is already applied!
    ci.intersecter1 = intersecter;
    Collidable ob = triBody;
    if (convexBody.shape().isConvex()) {
        tm.init(triangle[0], triangle[1], triangle[2]);
        tm.setMargin(collisionMarginTriangle);
        CollisionShape tmpShape = ob.shape();
        ob.internalSetTemporaryCollisionShape(tm);
        CollisionAlgorithm colAlgo = ci.intersecter1.findAlgorithm(convexBody, triBody, manifoldPtr);
        // this should use the btDispatcher, so the actual registered algorithm is used
        // btConvexConvexAlgorithm cvxcvxalgo(m_manifoldPtr,ci,m_convexBody,m_triBody);
        resultOut.setShapeIdentifiers(-1, -1, partId, triangleIndex);
        // cvxcvxalgo.setShapeIdentifiers(-1,-1,partId,triangleIndex);
        // cvxcvxalgo.processCollision(m_convexBody,m_triBody,*m_dispatchInfoPtr,m_resultOut);
        colAlgo.processCollision(convexBody, triBody, dispatchInfoPtr, resultOut);
        // colAlgo.destroy();
        Intersecter.freeCollisionAlgorithm(colAlgo);
        ob.internalSetTemporaryCollisionShape(tmpShape);
    }
}
Also used : Collidable(spacegraph.space3d.phys.Collidable) CollisionShape(spacegraph.space3d.phys.shape.CollisionShape) CollisionAlgorithm(spacegraph.space3d.phys.collision.broad.CollisionAlgorithm)

Aggregations

Collidable (spacegraph.space3d.phys.Collidable)1 CollisionAlgorithm (spacegraph.space3d.phys.collision.broad.CollisionAlgorithm)1 CollisionShape (spacegraph.space3d.phys.shape.CollisionShape)1