本文整理汇总了Java中com.bulletphysics.collision.dispatch.CollisionObject.setWorldTransform方法的典型用法代码示例。如果您正苦于以下问题:Java CollisionObject.setWorldTransform方法的具体用法?Java CollisionObject.setWorldTransform怎么用?Java CollisionObject.setWorldTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.bulletphysics.collision.dispatch.CollisionObject
的用法示例。
在下文中一共展示了CollisionObject.setWorldTransform方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: gimpact_vs_compoundshape
import com.bulletphysics.collision.dispatch.CollisionObject; //导入方法依赖的package包/类
public void gimpact_vs_compoundshape(CollisionObject body0, CollisionObject body1, GImpactShapeInterface shape0, CompoundShape shape1, boolean swapped) {
Stack stack = Stack.enter();
Transform orgtrans1 = body1.getWorldTransform(stack.allocTransform());
Transform childtrans1 = stack.allocTransform();
Transform tmpTrans = stack.allocTransform();
int i = shape1.getNumChildShapes();
while ((i--) != 0) {
CollisionShape colshape1 = shape1.getChildShape(i);
childtrans1.mul(orgtrans1, shape1.getChildTransform(i, tmpTrans));
body1.setWorldTransform(childtrans1);
// collide child shape
gimpact_vs_shape(body0, body1,
shape0, colshape1, swapped);
// restore transforms
body1.setWorldTransform(orgtrans1);
}
stack.leave();
}
示例2: gimpact_vs_compoundshape
import com.bulletphysics.collision.dispatch.CollisionObject; //导入方法依赖的package包/类
public void gimpact_vs_compoundshape(CollisionObject body0, CollisionObject body1, GImpactShapeInterface shape0, CompoundShape shape1, boolean swapped) {
Transform orgtrans1 = body1.getWorldTransform(Stack.alloc(Transform.class));
Transform childtrans1 = Stack.alloc(Transform.class);
Transform tmpTrans = Stack.alloc(Transform.class);
int i = shape1.getNumChildShapes();
while ((i--) != 0) {
CollisionShape colshape1 = shape1.getChildShape(i);
childtrans1.mul(orgtrans1, shape1.getChildTransform(i, tmpTrans));
body1.setWorldTransform(childtrans1);
// collide child shape
gimpact_vs_shape(body0, body1,
shape0, colshape1, swapped);
// restore transforms
body1.setWorldTransform(orgtrans1);
}
}
示例3: gimpact_vs_compoundshape
import com.bulletphysics.collision.dispatch.CollisionObject; //导入方法依赖的package包/类
public void gimpact_vs_compoundshape(CollisionObject body0, CollisionObject body1, GImpactShapeInterface shape0, CompoundShape shape1, boolean swapped) {
System.out.println("gimpact_vs_compoundshape");
Transform orgtrans1 = body1.getWorldTransform(Stack.alloc(Transform.class));
Transform childtrans1 = Stack.alloc(Transform.class);
Transform tmpTrans = Stack.alloc(Transform.class);
int i = shape1.getNumChildShapes();
while ((i--) != 0) {
CollisionShape colshape1 = shape1.getChildShape(i);
childtrans1.mul(orgtrans1, shape1.getChildTransform(i, tmpTrans));
body1.setWorldTransform(childtrans1);
// collide child shape
gimpact_vs_shape(body0, body1,
shape0, colshape1, swapped);
// restore transforms
body1.setWorldTransform(orgtrans1);
}
}
示例4: clientResetScene
import com.bulletphysics.collision.dispatch.CollisionObject; //导入方法依赖的package包/类
public void clientResetScene() {
//#ifdef SHOW_NUM_DEEP_PENETRATIONS
BulletStats.gNumDeepPenetrationChecks = 0;
BulletStats.gNumGjkChecks = 0;
//#endif //SHOW_NUM_DEEP_PENETRATIONS
int numObjects = 0;
if (dynamicsWorld != null) {
dynamicsWorld.stepSimulation(1f / 60f, 0);
numObjects = dynamicsWorld.getNumCollisionObjects();
}
for (int i = 0; i < numObjects; i++) {
CollisionObject colObj = dynamicsWorld.getCollisionObjectArray().get(i);
RigidBody body = RigidBody.upcast(colObj);
if (body != null) {
if (body.getMotionState() != null) {
DefaultMotionState myMotionState = (DefaultMotionState) body.getMotionState();
myMotionState.graphicsWorldTrans.set(myMotionState.startWorldTrans);
colObj.setWorldTransform(myMotionState.graphicsWorldTrans);
colObj.setInterpolationWorldTransform(myMotionState.startWorldTrans);
colObj.activate();
}
// removed cached contact points
dynamicsWorld.getBroadphase().getOverlappingPairCache().cleanProxyFromPairs(colObj.getBroadphaseHandle(), getDynamicsWorld().getDispatcher());
body = RigidBody.upcast(colObj);
if (body != null && !body.isStaticObject()) {
RigidBody.upcast(colObj).setLinearVelocity(new Vector3f(0f, 0f, 0f));
RigidBody.upcast(colObj).setAngularVelocity(new Vector3f(0f, 0f, 0f));
}
}
/*
//quickly search some issue at a certain simulation frame, pressing space to reset
int fixed=18;
for (int i=0;i<fixed;i++)
{
getDynamicsWorld()->stepSimulation(1./60.f,1);
}
*/
}
}
示例5: clientResetScene
import com.bulletphysics.collision.dispatch.CollisionObject; //导入方法依赖的package包/类
public void clientResetScene() {
//#ifdef SHOW_NUM_DEEP_PENETRATIONS
BulletStats.gNumDeepPenetrationChecks = 0;
BulletStats.gNumGjkChecks = 0;
//#endif //SHOW_NUM_DEEP_PENETRATIONS
int numObjects = 0;
if (dynamicsWorld != null) {
dynamicsWorld.stepSimulation(1f / 60f, 0);
numObjects = dynamicsWorld.getNumCollisionObjects();
}
for (int i = 0; i < numObjects; i++) {
CollisionObject colObj = dynamicsWorld.getCollisionObjectArray().getQuick(i);
RigidBody body = RigidBody.upcast(colObj);
if (body != null) {
if (body.getMotionState() != null) {
DefaultMotionState myMotionState = (DefaultMotionState) body.getMotionState();
myMotionState.graphicsWorldTrans.set(myMotionState.startWorldTrans);
colObj.setWorldTransform(myMotionState.graphicsWorldTrans);
colObj.setInterpolationWorldTransform(myMotionState.startWorldTrans);
colObj.activate();
}
// removed cached contact points
dynamicsWorld.getBroadphase().getOverlappingPairCache().cleanProxyFromPairs(colObj.getBroadphaseHandle(), getDynamicsWorld().getDispatcher());
body = RigidBody.upcast(colObj);
if (body != null && !body.isStaticObject()) {
RigidBody.upcast(colObj).setLinearVelocity(new Vector3f(0f, 0f, 0f));
RigidBody.upcast(colObj).setAngularVelocity(new Vector3f(0f, 0f, 0f));
}
}
/*
//quickly search some issue at a certain simulation frame, pressing space to reset
int fixed=18;
for (int i=0;i<fixed;i++)
{
getDynamicsWorld()->stepSimulation(1./60.f,1);
}
*/
}
}