• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CollisionObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.bulletphysics.collision.dispatch.CollisionObject的典型用法代码示例。如果您正苦于以下问题:Java CollisionObject类的具体用法?Java CollisionObject怎么用?Java CollisionObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CollisionObject类属于com.bulletphysics.collision.dispatch包,在下文中一共展示了CollisionObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: predictUnconstraintMotion

import com.bulletphysics.collision.dispatch.CollisionObject; //导入依赖的package包/类
protected void predictUnconstraintMotion(float timeStep) {
    Stack stack = Stack.enter();
	Transform tmpTrans = stack.allocTransform();
	
	for (int i = 0; i < collisionObjects.size(); i++) {
		CollisionObject colObj = collisionObjects.getQuick(i);
		RigidBody body = RigidBody.upcast(colObj);
		if (body != null) {
			if (!body.isStaticObject()) {
				if (body.isActive()) {
					body.applyGravity();
					body.integrateVelocities(timeStep);
					body.applyDamping(timeStep);
					body.predictIntegratedTransform(timeStep, body.getInterpolationWorldTransform(tmpTrans));
				}
			}
		}
	}
	stack.leave();
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:21,代码来源:SimpleDynamicsWorld.java


示例2: updateAabbs

import com.bulletphysics.collision.dispatch.CollisionObject; //导入依赖的package包/类
@Override
	public void updateAabbs() {
	    Stack stack = Stack.enter();
		Transform tmpTrans = stack.allocTransform();
//		Transform predictedTrans = stack.allocTransform();
		Vector3 minAabb = stack.allocVector3(), maxAabb = stack.allocVector3();

		for (int i = 0; i < collisionObjects.size(); i++) {
			CollisionObject colObj = collisionObjects.getQuick(i);
			RigidBody body = RigidBody.upcast(colObj);
			if (body != null) {
				if (body.isActive() && (!body.isStaticObject())) {
					colObj.getCollisionShape().getAabb(colObj.getWorldTransform(tmpTrans), minAabb, maxAabb);
					BroadphaseInterface bp = getBroadphase();
					bp.setAabb(body.getBroadphaseHandle(), minAabb, maxAabb, dispatcher1);
				}
			}
		}
		stack.leave();
	}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:21,代码来源:SimpleDynamicsWorld.java


示例3: synchronizeMotionStates

import com.bulletphysics.collision.dispatch.CollisionObject; //导入依赖的package包/类
public void synchronizeMotionStates() {
    Stack stack = Stack.enter();
	Transform tmpTrans = stack.allocTransform();
	
	// todo: iterate over awake simulation islands!
	for (int i = 0; i < collisionObjects.size(); i++) {
		CollisionObject colObj = collisionObjects.getQuick(i);
		RigidBody body = RigidBody.upcast(colObj);
		if (body != null && body.getMotionState() != null) {
			if (body.getActivationState() != CollisionObject.ISLAND_SLEEPING) {
				body.getMotionState().setWorldTransform(body.getWorldTransform(tmpTrans));
			}
		}
	}
	stack.leave();
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:17,代码来源:SimpleDynamicsWorld.java


示例4: checkCollideWithOverride

import com.bulletphysics.collision.dispatch.CollisionObject; //导入依赖的package包/类
@Override
public boolean checkCollideWithOverride (CollisionObject co) {
	// TODO: change to cast
	RigidBody otherRb = RigidBody.upcast(co);
	if (otherRb == null) {
		return true;
	}

	for (int i = 0; i < constraintRefs.size(); ++i) {
		TypedConstraint c = constraintRefs.getQuick(i);
		if (c.getRigidBodyA() == otherRb || c.getRigidBodyB() == otherRb) {
			return false;
		}
	}

	return true;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:18,代码来源:RigidBody.java


示例5: 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


示例6: gimpact_vs_concave

import com.bulletphysics.collision.dispatch.CollisionObject; //导入依赖的package包/类
public void gimpact_vs_concave(CollisionObject body0, CollisionObject body1, GImpactShapeInterface shape0, ConcaveShape shape1, boolean swapped) {
	// create the callback
	GImpactTriangleCallback tricallback = new GImpactTriangleCallback();
	tricallback.algorithm = this;
	tricallback.body0 = body0;
	tricallback.body1 = body1;
	tricallback.gimpactshape0 = shape0;
	tricallback.swapped = swapped;
	tricallback.margin = shape1.getMargin();

	// getting the trimesh AABB
	Stack stack = Stack.enter();
	Transform gimpactInConcaveSpace = stack.allocTransform();

	body1.getWorldTransform(gimpactInConcaveSpace);
	gimpactInConcaveSpace.inverse();
	gimpactInConcaveSpace.mul(body0.getWorldTransform(stack.allocTransform()));

	Vector3 minAABB = stack.allocVector3(), maxAABB = stack.allocVector3();
	shape0.getAabb(gimpactInConcaveSpace, minAABB, maxAABB);

	shape1.processAllTriangles(tricallback, minAABB, maxAABB);
	stack.leave();
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:25,代码来源:GImpactCollisionAlgorithm.java


示例7: shape_vs_shape_collision

import com.bulletphysics.collision.dispatch.CollisionObject; //导入依赖的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);
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:23,代码来源:GImpactCollisionAlgorithm.java


示例8: predictUnconstraintMotion

import com.bulletphysics.collision.dispatch.CollisionObject; //导入依赖的package包/类
protected void predictUnconstraintMotion(float timeStep) {
	BulletStats.pushProfile("predictUnconstraintMotion");
	try {
		Transform tmpTrans = Stack.alloc(Transform.class);
		
		for (int i = 0; i < collisionObjects.size(); i++) {
			CollisionObject colObj = collisionObjects.getQuick(i);
			RigidBody body = RigidBody.upcast(colObj);
			if (body != null) {
				if (!body.isStaticOrKinematicObject()) {
					if (body.isActive()) {
						body.integrateVelocities(timeStep);
						// damping
						body.applyDamping(timeStep);

						body.predictIntegratedTransform(timeStep, body.getInterpolationWorldTransform(tmpTrans));
					}
				}
			}
		}
	}
	finally {
		BulletStats.popProfile();
	}
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:26,代码来源:DiscreteDynamicsWorld.java


示例9: predictUnconstraintMotion

import com.bulletphysics.collision.dispatch.CollisionObject; //导入依赖的package包/类
protected void predictUnconstraintMotion(float timeStep) {
	Transform tmpTrans = Stack.alloc(Transform.class);
	
	for (int i = 0; i < collisionObjects.size(); i++) {
		CollisionObject colObj = collisionObjects.getQuick(i);
		RigidBody body = RigidBody.upcast(colObj);
		if (body != null) {
			if (!body.isStaticObject()) {
				if (body.isActive()) {
					body.applyGravity();
					body.integrateVelocities(timeStep);
					body.applyDamping(timeStep);
					body.predictIntegratedTransform(timeStep, body.getInterpolationWorldTransform(tmpTrans));
				}
			}
		}
	}
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:19,代码来源:SimpleDynamicsWorld.java


示例10: updateAabbs

import com.bulletphysics.collision.dispatch.CollisionObject; //导入依赖的package包/类
@Override
public void updateAabbs() {
	Transform tmpTrans = Stack.alloc(Transform.class);
	Transform predictedTrans = Stack.alloc(Transform.class);
	Vector3f minAabb = Stack.alloc(Vector3f.class), maxAabb = Stack.alloc(Vector3f.class);

	for (int i = 0; i < collisionObjects.size(); i++) {
		CollisionObject colObj = collisionObjects.getQuick(i);
		RigidBody body = RigidBody.upcast(colObj);
		if (body != null) {
			if (body.isActive() && (!body.isStaticObject())) {
				colObj.getCollisionShape().getAabb(colObj.getWorldTransform(tmpTrans), minAabb, maxAabb);
				BroadphaseInterface bp = getBroadphase();
				bp.setAabb(body.getBroadphaseHandle(), minAabb, maxAabb, dispatcher1);
			}
		}
	}
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:19,代码来源:SimpleDynamicsWorld.java


示例11: checkCollideWithOverride

import com.bulletphysics.collision.dispatch.CollisionObject; //导入依赖的package包/类
@Override
public boolean checkCollideWithOverride(CollisionObject co) {
	// TODO: change to cast
	RigidBody otherRb = RigidBody.upcast(co);
	if (otherRb == null) {
		return true;
	}

	for (int i = 0; i < constraintRefs.size(); ++i) {
		TypedConstraint c = constraintRefs.getQuick(i);
		if (c.getRigidBodyA() == otherRb || c.getRigidBodyB() == otherRb) {
			return false;
		}
	}

	return true;
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:18,代码来源:RigidBody.java


示例12: initSolverBody

import com.bulletphysics.collision.dispatch.CollisionObject; //导入依赖的package包/类
private void initSolverBody(SolverBody solverBody, CollisionObject collisionObject) {
	RigidBody rb = RigidBody.upcast(collisionObject);
	if (rb != null) {
		rb.getAngularVelocity(solverBody.angularVelocity);
		solverBody.centerOfMassPosition.set(collisionObject.getWorldTransform(Stack.alloc(Transform.class)).origin);
		solverBody.friction = collisionObject.getFriction();
		solverBody.invMass = rb.getInvMass();
		rb.getLinearVelocity(solverBody.linearVelocity);
		solverBody.originalBody = rb;
		solverBody.angularFactor = rb.getAngularFactor();
	}
	else {
		solverBody.angularVelocity.set(0f, 0f, 0f);
		solverBody.centerOfMassPosition.set(collisionObject.getWorldTransform(Stack.alloc(Transform.class)).origin);
		solverBody.friction = collisionObject.getFriction();
		solverBody.invMass = 0f;
		solverBody.linearVelocity.set(0f, 0f, 0f);
		solverBody.originalBody = null;
		solverBody.angularFactor = 1f;
	}

	solverBody.pushVelocity.set(0f, 0f, 0f);
	solverBody.turnVelocity.set(0f, 0f, 0f);
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:25,代码来源:SequentialImpulseConstraintSolver.java


示例13: 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


示例14: gimpact_vs_concave

import com.bulletphysics.collision.dispatch.CollisionObject; //导入依赖的package包/类
public void gimpact_vs_concave(CollisionObject body0, CollisionObject body1, GImpactShapeInterface shape0, ConcaveShape shape1, boolean swapped) {
	// create the callback
	GImpactTriangleCallback tricallback = new GImpactTriangleCallback();
	tricallback.algorithm = this;
	tricallback.body0 = body0;
	tricallback.body1 = body1;
	tricallback.gimpactshape0 = shape0;
	tricallback.swapped = swapped;
	tricallback.margin = shape1.getMargin();

	// getting the trimesh AABB
	Transform gimpactInConcaveSpace = Stack.alloc(Transform.class);

	body1.getWorldTransform(gimpactInConcaveSpace);
	gimpactInConcaveSpace.inverse();
	gimpactInConcaveSpace.mul(body0.getWorldTransform(Stack.alloc(Transform.class)));

	Vector3f minAABB = Stack.alloc(Vector3f.class), maxAABB = Stack.alloc(Vector3f.class);
	shape0.getAabb(gimpactInConcaveSpace, minAABB, maxAABB);

	shape1.processAllTriangles(tricallback, minAABB, maxAABB);
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:23,代码来源:GImpactCollisionAlgorithm.java


示例15: contactProcessed

import com.bulletphysics.collision.dispatch.CollisionObject; //导入依赖的package包/类
@Override
public boolean contactProcessed(ManifoldPoint arg0, Object obj1, Object obj2)
{
  CollisionObject o1 = (CollisionObject) obj1;
  CollisionObject o2 = (CollisionObject) obj2;

  for (PhysicsBody body : watchList)
  {
    if (body.body == o1)
    {

      body.collidedWith(o2);
    }
    else if (body.body == o2)
    {

      body.collidedWith(o1);
    }
  }
  return false;
}
 
开发者ID:l50,项目名称:redrun,代码行数:22,代码来源:PhysicsWorld.java


示例16: contactAdded

import com.bulletphysics.collision.dispatch.CollisionObject; //导入依赖的package包/类
public boolean contactAdded(ManifoldPoint cp, CollisionObject colObj0, int partId0, int index0, CollisionObject colObj1, int partId1, int index1) {
	float friction0 = colObj0.getFriction();
	float friction1 = colObj1.getFriction();
	float restitution0 = colObj0.getRestitution();
	float restitution1 = colObj1.getRestitution();

	if ((colObj0.getCollisionFlags() & CollisionFlags.CUSTOM_MATERIAL_CALLBACK) != 0) {
		friction0 = 1f; //partId0,index0
		restitution0 = 0f;
	}
	if ((colObj1.getCollisionFlags() & CollisionFlags.CUSTOM_MATERIAL_CALLBACK) != 0) {
		if ((index1 & 1) != 0) {
			friction1 = 1f; //partId1,index1
		}
		else {
			friction1 = 0f;
		}
		restitution1 = 0f;
	}

	cp.combinedFriction = calculateCombinedFriction(friction0, friction1);
	cp.combinedRestitution = calculateCombinedRestitution(restitution0, restitution1);

	// this return value is currently ignored, but to be on the safe side: return false if you don't calculate friction
	return true;
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:27,代码来源:ConcaveDemo.java


示例17: integrateTransforms

import com.bulletphysics.collision.dispatch.CollisionObject; //导入依赖的package包/类
protected void integrateTransforms(float timeStep) {
	BulletStats.pushProfile("integrateTransforms");
	try {
		Transform predictedTrans = Stack.alloc(Transform.class);
		for (int i = 0; i < collisionObjects.size(); i++) {
			CollisionObject colObj = collisionObjects.get(i);
			RigidBody body = RigidBody.upcast(colObj);
			if (body != null) {
				if (body.isActive() && (!body.isStaticOrKinematicObject())) {
					body.predictIntegratedTransform(timeStep, predictedTrans);
					body.proceedToTransform(predictedTrans);
				}
			}
		}
	}
	finally {
		BulletStats.popProfile();
	}
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:20,代码来源:DiscreteDynamicsWorld.java


示例18: predictUnconstraintMotion

import com.bulletphysics.collision.dispatch.CollisionObject; //导入依赖的package包/类
protected void predictUnconstraintMotion(float timeStep) {
	BulletStats.pushProfile("predictUnconstraintMotion");
	try {
		Transform tmpTrans = Stack.alloc(Transform.class);
		
		for (int i = 0; i < collisionObjects.size(); i++) {
			CollisionObject colObj = collisionObjects.get(i);
			RigidBody body = RigidBody.upcast(colObj);
			if (body != null) {
				if (!body.isStaticOrKinematicObject()) {
					if (body.isActive()) {
						body.integrateVelocities(timeStep);
						// damping
						body.applyDamping(timeStep);

						body.predictIntegratedTransform(timeStep, body.getInterpolationWorldTransform(tmpTrans));
					}
				}
			}
		}
	}
	finally {
		BulletStats.popProfile();
	}
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:26,代码来源:DiscreteDynamicsWorld.java


示例19: predictUnconstraintMotion

import com.bulletphysics.collision.dispatch.CollisionObject; //导入依赖的package包/类
protected void predictUnconstraintMotion(float timeStep) {
	Transform tmpTrans = Stack.alloc(Transform.class);
	
	for (int i = 0; i < collisionObjects.size(); i++) {
		CollisionObject colObj = collisionObjects.get(i);
		RigidBody body = RigidBody.upcast(colObj);
		if (body != null) {
			if (!body.isStaticObject()) {
				if (body.isActive()) {
					body.applyGravity();
					body.integrateVelocities(timeStep);
					body.applyDamping(timeStep);
					body.predictIntegratedTransform(timeStep, body.getInterpolationWorldTransform(tmpTrans));
				}
			}
		}
	}
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:19,代码来源:SimpleDynamicsWorld.java


示例20: updateAabbs

import com.bulletphysics.collision.dispatch.CollisionObject; //导入依赖的package包/类
@Override
public void updateAabbs() {
	Transform tmpTrans = Stack.alloc(Transform.class);
	Transform predictedTrans = Stack.alloc(Transform.class);
	Vector3f minAabb = Stack.alloc(Vector3f.class), maxAabb = Stack.alloc(Vector3f.class);

	for (int i = 0; i < collisionObjects.size(); i++) {
		CollisionObject colObj = collisionObjects.get(i);
		RigidBody body = RigidBody.upcast(colObj);
		if (body != null) {
			if (body.isActive() && (!body.isStaticObject())) {
				colObj.getCollisionShape().getAabb(colObj.getWorldTransform(tmpTrans), minAabb, maxAabb);
				BroadphaseInterface bp = getBroadphase();
				bp.setAabb(body.getBroadphaseHandle(), minAabb, maxAabb, dispatcher1);
			}
		}
	}
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:19,代码来源:SimpleDynamicsWorld.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PlayerInteractEvent类代码示例发布时间:2022-05-21
下一篇:
Java WhileStatement类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap