本文整理汇总了Java中com.bulletphysics.collision.broadphase.CollisionAlgorithm.processCollision方法的典型用法代码示例。如果您正苦于以下问题:Java CollisionAlgorithm.processCollision方法的具体用法?Java CollisionAlgorithm.processCollision怎么用?Java CollisionAlgorithm.processCollision使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.bulletphysics.collision.broadphase.CollisionAlgorithm
的用法示例。
在下文中一共展示了CollisionAlgorithm.processCollision方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shape_vs_shape_collision
import com.bulletphysics.collision.broadphase.CollisionAlgorithm; //导入方法依赖的package包/类
protected void shape_vs_shape_collision(CollisionObject body0, CollisionObject body1, CollisionShape shape0, CollisionShape shape1) {
CollisionShape tmpShape0 = body0.getCollisionShape();
CollisionShape tmpShape1 = body1.getCollisionShape();
body0.internalSetTemporaryCollisionShape(shape0);
body1.internalSetTemporaryCollisionShape(shape1);
{
CollisionAlgorithm algor = newAlgorithm(body0, body1);
// post : checkManifold is called
resultOut.setShapeIdentifiers(part0, triface0, part1, triface1);
algor.processCollision(body0, body1, dispatchInfo, resultOut);
//algor.destroy();
dispatcher.freeCollisionAlgorithm(algor);
}
body0.internalSetTemporaryCollisionShape(tmpShape0);
body1.internalSetTemporaryCollisionShape(tmpShape1);
}
示例2: processTriangle
import com.bulletphysics.collision.broadphase.CollisionAlgorithm; //导入方法依赖的package包/类
public void processTriangle(Vector3[] triangle, int partId, int triangleIndex) {
// just for debugging purposes
//printf("triangle %d",m_triangleCount++);
// aabb filter is already applied!
ci.dispatcher1 = dispatcher;
CollisionObject ob = (CollisionObject) triBody;
// debug drawing of the overlapping triangles
if (dispatchInfoPtr != null && dispatchInfoPtr.debugDraw != null && dispatchInfoPtr.debugDraw.getDebugMode() > 0) {
Stack stack = Stack.enter();
Vector3 color = stack.allocVector3();
color.set(255, 255, 0);
Transform tr = ob.getWorldTransform(stack.allocTransform());
Vector3 tmp1 = stack.allocVector3();
Vector3 tmp2 = stack.allocVector3();
tmp1.set(triangle[0]); tr.transform(tmp1);
tmp2.set(triangle[1]); tr.transform(tmp2);
dispatchInfoPtr.debugDraw.drawLine(tmp1, tmp2, color);
tmp1.set(triangle[1]); tr.transform(tmp1);
tmp2.set(triangle[2]); tr.transform(tmp2);
dispatchInfoPtr.debugDraw.drawLine(tmp1, tmp2, color);
tmp1.set(triangle[2]); tr.transform(tmp1);
tmp2.set(triangle[0]); tr.transform(tmp2);
dispatchInfoPtr.debugDraw.drawLine(tmp1, tmp2, color);
//btVector3 center = triangle[0] + triangle[1]+triangle[2];
//center *= btScalar(0.333333);
//m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[0]),tr(center),color);
//m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[1]),tr(center),color);
//m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[2]),tr(center),color);
stack.leave();
}
//btCollisionObject* colObj = static_cast<btCollisionObject*>(m_convexProxy->m_clientObject);
if (convexBody.getCollisionShape().isConvex()) {
tm.init(triangle[0], triangle[1], triangle[2]);
tm.setMargin(collisionMarginTriangle);
CollisionShape tmpShape = ob.getCollisionShape();
ob.internalSetTemporaryCollisionShape(tm);
CollisionAlgorithm colAlgo = ci.dispatcher1.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();
ci.dispatcher1.freeCollisionAlgorithm(colAlgo);
ob.internalSetTemporaryCollisionShape(tmpShape);
}
}
示例3: processTriangle
import com.bulletphysics.collision.broadphase.CollisionAlgorithm; //导入方法依赖的package包/类
public void processTriangle(Vector3f[] triangle, int partId, int triangleIndex) {
// just for debugging purposes
//printf("triangle %d",m_triangleCount++);
// aabb filter is already applied!
ci.dispatcher1 = dispatcher;
CollisionObject ob = (CollisionObject) triBody;
// debug drawing of the overlapping triangles
if (dispatchInfoPtr != null && dispatchInfoPtr.debugDraw != null && dispatchInfoPtr.debugDraw.getDebugMode() > 0) {
Vector3f color = Stack.alloc(Vector3f.class);
color.set(255, 255, 0);
Transform tr = ob.getWorldTransform(Stack.alloc(Transform.class));
Vector3f tmp1 = Stack.alloc(Vector3f.class);
Vector3f tmp2 = Stack.alloc(Vector3f.class);
tmp1.set(triangle[0]); tr.transform(tmp1);
tmp2.set(triangle[1]); tr.transform(tmp2);
dispatchInfoPtr.debugDraw.drawLine(tmp1, tmp2, color);
tmp1.set(triangle[1]); tr.transform(tmp1);
tmp2.set(triangle[2]); tr.transform(tmp2);
dispatchInfoPtr.debugDraw.drawLine(tmp1, tmp2, color);
tmp1.set(triangle[2]); tr.transform(tmp1);
tmp2.set(triangle[0]); tr.transform(tmp2);
dispatchInfoPtr.debugDraw.drawLine(tmp1, tmp2, color);
//btVector3 center = triangle[0] + triangle[1]+triangle[2];
//center *= btScalar(0.333333);
//m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[0]),tr(center),color);
//m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[1]),tr(center),color);
//m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[2]),tr(center),color);
}
//btCollisionObject* colObj = static_cast<btCollisionObject*>(m_convexProxy->m_clientObject);
if (convexBody.getCollisionShape().isConvex()) {
tm.init(triangle[0], triangle[1], triangle[2]);
tm.setMargin(collisionMarginTriangle);
CollisionShape tmpShape = ob.getCollisionShape();
ob.internalSetTemporaryCollisionShape(tm);
CollisionAlgorithm colAlgo = ci.dispatcher1.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();
ci.dispatcher1.freeCollisionAlgorithm(colAlgo);
ob.internalSetTemporaryCollisionShape(tmpShape);
}
}