当前位置: 首页>>代码示例>>Java>>正文


Java CollisionObject.setWorldTransform方法代码示例

本文整理汇总了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();
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:23,代码来源:GImpactCollisionAlgorithm.java

示例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);
	}
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:21,代码来源:GImpactCollisionAlgorithm.java

示例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);
	}
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:22,代码来源:GImpactCollisionAlgorithm.java

示例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);
		}
		*/
	}
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:44,代码来源:DemoApplication.java

示例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);
		}
		*/
	}
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:44,代码来源:DemoApplication.java


注:本文中的com.bulletphysics.collision.dispatch.CollisionObject.setWorldTransform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。