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


Java ConvexShape类代码示例

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


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

示例1: read

import com.bulletphysics.collision.shapes.ConvexShape; //导入依赖的package包/类
@Override
public void read(JmeImporter e) throws IOException {
    super.read(e);
    InputCapsule capsule = e.getCapsule(this);
    stepHeight = capsule.readFloat("stepHeight", 1.0f);
    buildObject();
    character = new KinematicCharacterController(gObject, (ConvexShape) collisionShape.getCShape(), stepHeight);
    setGravity(capsule.readFloat("gravity", 9.8f * 3));
    setMaxSlope(capsule.readFloat("maxSlope", 1.0f));
    setFallSpeed(capsule.readFloat("fallSpeed", 55.0f));
    setJumpSpeed(capsule.readFloat("jumpSpeed", 10.0f));
    setUpAxis(capsule.readInt("upAxis", 1));
    setCcdMotionThreshold(capsule.readFloat("ccdMotionThreshold", 0));
    setCcdSweptSphereRadius(capsule.readFloat("ccdSweptSphereRadius", 0));
    setPhysicsLocation((Vector3f) capsule.readSavable("physicsLocation", new Vector3f()));
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:PhysicsCharacter.java

示例2: calcPenDepth

import com.bulletphysics.collision.shapes.ConvexShape; //导入依赖的package包/类
public boolean calcPenDepth(SimplexSolverInterface simplexSolver,
											  ConvexShape pConvexA, ConvexShape pConvexB,
											  Transform transformA, Transform transformB,
											  Vector3 v, Vector3 wWitnessOnA, Vector3 wWitnessOnB,
											  IDebugDraw debugDraw/*, btStackAlloc* stackAlloc*/)
{
	float radialmargin = 0f;

	// JAVA NOTE: 2.70b1: update when GjkEpaSolver2 is ported
	
	GjkEpaSolver.Results results = new GjkEpaSolver.Results();
	if (gjkEpaSolver.collide(pConvexA, transformA,
			pConvexB, transformB,
			radialmargin/*,stackAlloc*/, results)) {
		//debugDraw->drawLine(results.witnesses[1],results.witnesses[1]+results.normal,btVector3(255,0,0));
		//resultOut->addContactPoint(results.normal,results.witnesses[1],-results.depth);
		wWitnessOnA.set(results.witnesses[0]);
		wWitnessOnB.set(results.witnesses[1]);
		return true;
	}

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

示例3: KinematicCharacterController

import com.bulletphysics.collision.shapes.ConvexShape; //导入依赖的package包/类
public KinematicCharacterController (PairCachingGhostObject ghostObject, ConvexShape convexShape, float stepHeight,
	int upAxis) {
	this.upAxis = upAxis;
	this.addedMargin = 0.02f;
	this.walkDirection.set(0, 0, 0);
	this.useGhostObjectSweepTest = true;
	this.ghostObject = ghostObject;
	this.stepHeight = stepHeight;
	this.turnAngle = 0.0f;
	this.convexShape = convexShape;
	this.useWalkDirection = true;
	this.velocityTimeInterval = 0.0f;
	this.verticalVelocity = 0.0f;
	this.verticalOffset = 0.0f;
	this.gravity = 9.8f; // 1G acceleration
	this.fallSpeed = 55.0f; // Terminal velocity of a sky diver in m/s.
	this.jumpSpeed = 10.0f; // ?
	this.wasOnGround = false;
	setMaxSlope((float)((50.0f / 180.0f) * Math.PI));
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:21,代码来源:KinematicCharacterController.java

示例4: calcPenDepth

import com.bulletphysics.collision.shapes.ConvexShape; //导入依赖的package包/类
public boolean calcPenDepth(SimplexSolverInterface simplexSolver,
											  ConvexShape pConvexA, ConvexShape pConvexB,
											  Transform transformA, Transform transformB,
											  Vector3f v, Vector3f wWitnessOnA, Vector3f wWitnessOnB,
											  IDebugDraw debugDraw/*, btStackAlloc* stackAlloc*/)
{
	float radialmargin = 0f;

	// JAVA NOTE: 2.70b1: update when GjkEpaSolver2 is ported
	
	GjkEpaSolver.Results results = new GjkEpaSolver.Results();
	if (gjkEpaSolver.collide(pConvexA, transformA,
			pConvexB, transformB,
			radialmargin/*,stackAlloc*/, results)) {
		//debugDraw->drawLine(results.witnesses[1],results.witnesses[1]+results.normal,btVector3(255,0,0));
		//resultOut->addContactPoint(results.normal,results.witnesses[1],-results.depth);
		wWitnessOnA.set(results.witnesses[0]);
		wWitnessOnB.set(results.witnesses[1]);
		return true;
	}

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

示例5: init

import com.bulletphysics.collision.shapes.ConvexShape; //导入依赖的package包/类
public void init(/*StackAlloc psa,*/
		Matrix3f wrot0, Vector3f pos0, ConvexShape shape0,
		Matrix3f wrot1, Vector3f pos1, ConvexShape shape1,
		float pmargin) {
	pushStack();
	wrotations[0].set(wrot0);
	positions[0].set(pos0);
	shapes[0] = shape0;
	wrotations[1].set(wrot1);
	positions[1].set(pos1);
	shapes[1] = shape1;
	//sa		=psa;
	//sablock	=sa->beginBlock();
	margin = pmargin;
	failed = false;
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:17,代码来源:GjkEpaSolver.java

示例6: KinematicCharacterController

import com.bulletphysics.collision.shapes.ConvexShape; //导入依赖的package包/类
public KinematicCharacterController(PairCachingGhostObject ghostObject, ConvexShape convexShape, float stepHeight, int upAxis) {
	this.upAxis = upAxis;
	this.addedMargin = 0.02f;
	this.walkDirection.set(0, 0, 0);
	this.useGhostObjectSweepTest = true;
	this.ghostObject = ghostObject;
	this.stepHeight = stepHeight;
	this.turnAngle = 0.0f;
	this.convexShape = convexShape;
	this.useWalkDirection = true;
	this.velocityTimeInterval = 0.0f;
	this.verticalVelocity = 0.0f;
	this.verticalOffset = 0.0f;
	this.gravity = 9.8f; // 1G acceleration
	this.fallSpeed = 55.0f; // Terminal velocity of a sky diver in m/s.
	this.jumpSpeed = 10.0f; // ?
	this.wasOnGround = false;
	setMaxSlope((float)((50.0f/180.0f) * Math.PI));
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:20,代码来源:KinematicCharacterController.java

示例7: calcPenDepth

import com.bulletphysics.collision.shapes.ConvexShape; //导入依赖的package包/类
public boolean calcPenDepth(SimplexSolverInterface simplexSolver,
											  ConvexShape pConvexA, ConvexShape pConvexB,
											  Transform transformA, Transform transformB,
											  Vector3f v, Vector3f wWitnessOnA, Vector3f wWitnessOnB,
											  IDebugDraw debugDraw/*, btStackAlloc* stackAlloc*/)
{
	float radialmargin = 0f;

	// JAVA NOTE: 2.70b1: update when GjkEpaSolver2 is ported
	
	GjkEpaSolver.Results results = new GjkEpaSolver.Results();
	if (GjkEpaSolver.collide(pConvexA, transformA,
			pConvexB, transformB,
			radialmargin/*,stackAlloc*/, results)) {
		//debugDraw->drawLine(results.witnesses[1],results.witnesses[1]+results.normal,btVector3(255,0,0));
		//resultOut->addContactPoint(results.normal,results.witnesses[1],-results.depth);
		wWitnessOnA.set(results.witnesses[0]);
		wWitnessOnB.set(results.witnesses[1]);
		return true;
	}

	return false;
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:24,代码来源:GjkEpaPenetrationDepthSolver.java

示例8: createRigidBody

import com.bulletphysics.collision.shapes.ConvexShape; //导入依赖的package包/类
private void createRigidBody(EntityRef entity) {
    LocationComponent location = entity.getComponent(LocationComponent.class);
    RigidBodyComponent rigidBody = entity.getComponent(RigidBodyComponent.class);
    ConvexShape shape = getShapeFor(entity);
    if (shape != null) {
        float scale = location.getWorldScale();
        shape.setLocalScaling(new Vector3f(scale, scale, scale));

        Vector3f fallInertia = new Vector3f();
        shape.calculateLocalInertia(rigidBody.mass, fallInertia);
        RigidBodyConstructionInfo info = new RigidBodyConstructionInfo(rigidBody.mass, new EntityMotionState(entity), shape, fallInertia);
        RigidBody collider = new RigidBody(info);
        collider.setUserPointer(entity);
        updateKinematicSettings(rigidBody, collider);
        RigidBody oldBody = entityRigidBodies.put(entity, collider);
        physics.addRigidBody(collider, Lists.<CollisionGroup>newArrayList(rigidBody.collisionGroup), rigidBody.collidesWith);
        if (oldBody != null) {
            physics.removeRigidBody(oldBody);
        }
    }
}
 
开发者ID:zoneXcoding,项目名称:Mineworld,代码行数:22,代码来源:PhysicsSystem.java

示例9: PhysicsCharacter

import com.bulletphysics.collision.shapes.ConvexShape; //导入依赖的package包/类
/**
 * @param shape The CollisionShape (no Mesh or CompoundCollisionShapes)
 * @param stepHeight The quantization size for vertical movement
 */
public PhysicsCharacter(CollisionShape shape, float stepHeight) {
    this.collisionShape = shape;
    if (!(shape.getCShape() instanceof ConvexShape)) {
        throw (new UnsupportedOperationException("Kinematic character nodes cannot have mesh collision shapes"));
    }
    this.stepHeight = stepHeight;
    buildObject();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:13,代码来源:PhysicsCharacter.java

示例10: setCollisionShape

import com.bulletphysics.collision.shapes.ConvexShape; //导入依赖的package包/类
@Override
public void setCollisionShape(CollisionShape collisionShape) {
    if (!(collisionShape.getCShape() instanceof ConvexShape)) {
        throw (new UnsupportedOperationException("Kinematic character nodes cannot have mesh collision shapes"));
    }
    super.setCollisionShape(collisionShape);
    if (gObject == null) {
        buildObject();
    }else{
        gObject.setCollisionShape(collisionShape.getCShape());
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:13,代码来源:PhysicsCharacter.java

示例11: sweepTest

import com.bulletphysics.collision.shapes.ConvexShape; //导入依赖的package包/类
/**
 * Performs a sweep collision test and returns the results as a list of PhysicsSweepTestResults<br/>
 * You have to use different Transforms for start and end (at least distance > 0.4f).
 * SweepTest will not see a collision if it starts INSIDE an object and is moving AWAY from its center.
 */
public List<PhysicsSweepTestResult> sweepTest(CollisionShape shape, Transform start, Transform end) {
    List<PhysicsSweepTestResult> results = new LinkedList<PhysicsSweepTestResult>();
    if (!(shape.getCShape() instanceof ConvexShape)) {
        Logger.getLogger(PhysicsSpace.class.getName()).log(Level.WARNING, "Trying to sweep test with incompatible mesh shape!");
        return results;
    }
    dynamicsWorld.convexSweepTest((ConvexShape) shape.getCShape(), Converter.convert(start, sweepTrans1), Converter.convert(end, sweepTrans2), new InternalSweepListener(results));
    return results;

}
 
开发者ID:mleoking,项目名称:PhET,代码行数:16,代码来源:PhysicsSpace.java

示例12: TriangleConvexcastCallback

import com.bulletphysics.collision.shapes.ConvexShape; //导入依赖的package包/类
public TriangleConvexcastCallback (ConvexShape convexShape, Transform convexShapeFrom, Transform convexShapeTo,
	Transform triangleToWorld, float triangleCollisionMargin) {
	this.convexShape = convexShape;
	this.convexShapeFrom.set(convexShapeFrom);
	this.convexShapeTo.set(convexShapeTo);
	this.triangleToWorld.set(triangleToWorld);
	this.hitFraction = 1f;
	this.triangleCollisionMargin = triangleCollisionMargin;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:10,代码来源:TriangleConvexcastCallback.java

示例13: init

import com.bulletphysics.collision.shapes.ConvexShape; //导入依赖的package包/类
public void init (ConvexShape objectA, ConvexShape objectB, SimplexSolverInterface simplexSolver,
	ConvexPenetrationDepthSolver penetrationDepthSolver) {
	this.cachedSeparatingAxis.set(0f, 0f, 1f);
	this.ignoreMargin = false;
	this.lastUsedMethod = -1;
	this.catchDegeneracies = 1;

	this.penetrationDepthSolver = penetrationDepthSolver;
	this.simplexSolver = simplexSolver;
	this.minkowskiA = objectA;
	this.minkowskiB = objectB;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:13,代码来源:GjkPairDetector.java

示例14: init

import com.bulletphysics.collision.shapes.ConvexShape; //导入依赖的package包/类
public void init (/* StackAlloc psa, */
	Matrix3 wrot0, Vector3 pos0, ConvexShape shape0, Matrix3 wrot1, Vector3 pos1, ConvexShape shape1, float pmargin) {
	pushStack();
	wrotations[0].set(wrot0);
	positions[0].set(pos0);
	shapes[0] = shape0;
	wrotations[1].set(wrot1);
	positions[1].set(pos1);
	shapes[1] = shape1;
	// sa =psa;
	// sablock =sa->beginBlock();
	margin = pmargin;
	failed = false;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:15,代码来源:GjkEpaSolver.java

示例15: BridgeTriangleConvexcastCallback

import com.bulletphysics.collision.shapes.ConvexShape; //导入依赖的package包/类
public BridgeTriangleConvexcastCallback (ConvexShape castShape, Transform from, Transform to,
	ConvexResultCallback resultCallback, CollisionObject collisionObject, TriangleMeshShape triangleMesh,
	Transform triangleToWorld) {
	super(castShape, from, to, triangleToWorld, triangleMesh.getMargin());
	this.resultCallback = resultCallback;
	this.collisionObject = collisionObject;
	this.triangleMesh = triangleMesh;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:9,代码来源:CollisionWorld.java


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