本文整理汇总了Java中com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java DefaultCollisionConfiguration类的具体用法?Java DefaultCollisionConfiguration怎么用?Java DefaultCollisionConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultCollisionConfiguration类属于com.bulletphysics.collision.dispatch包,在下文中一共展示了DefaultCollisionConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration; //导入依赖的package包/类
/**
* Set up the physics engine for the scene.
*/
public void setUp() {
// Create a DBVT broadphase to broadly check collisions using the AABB technique which ensures good performance
BroadphaseInterface broadphase = new DbvtBroadphase();
// Set up a collision configuration and dispatcher
CollisionConfiguration collisionConfig = new DefaultCollisionConfiguration();
CollisionDispatcher dispatcher = new CollisionDispatcher(collisionConfig);
// Configure a constraint solver
ConstraintSolver solver = new SequentialImpulseConstraintSolver();
// Create and configure the Bullet physics dynamic world
this.bulletDynamicsWorld = new DiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfig);
this.bulletDynamicsWorld.setGravity(new Vector3f(0, -9.81f, 0));
}
示例2: Scene
import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration; //导入依赖的package包/类
public Scene() {
sun = new DirectionalLight(vec3(-1.0f, -1.0f, 0.2f), vec3(2.0f, 2.0f, 2.0f), Settings.ENABLE_SHADOWS, 30, Settings.SHADOW_RESOLUTION);
//setup bullet
BroadphaseInterface broadphase = new DbvtBroadphase();
DefaultCollisionConfiguration collisionConfiguration = new DefaultCollisionConfiguration();
CollisionDispatcher dispatcher = new CollisionDispatcher(collisionConfiguration);
SequentialImpulseConstraintSolver solver = new SequentialImpulseConstraintSolver();
world = new DiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
// set the gravity of our world
world.setGravity(new Vector3f(0, -9.8f, 0));
//setup jbox2D
world2D = new World(new Vector2(0, -9.8f));
world2D.setContactListener(this);
}
示例3: Screen
import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration; //导入依赖的package包/类
public Screen() {
/*
Set the color to black
*/
glClearColor(0, 0, 0, 1);
BroadphaseInterface broadphase = new DbvtBroadphase();
CollisionConfiguration collisionConfiguration = new DefaultCollisionConfiguration();
CollisionDispatcher dispatcher = new CollisionDispatcher(collisionConfiguration);
ConstraintSolver solver = new SequentialImpulseConstraintSolver();
physicsWorld = new DiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
physicsWorld.setGravity(new Vector3f(0, -10 /* m/s2 */, 0));
/*
initialize the entities list
*/
entities = new LinkedList<>();
camera = new Camera(1280, 720, 67f, 0.1f, 1000000000000f);
//call the create method
create();
}
示例4: initialize
import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration; //导入依赖的package包/类
public static void initialize() {
destroy();
logger.info("Physics System initilize");
worldBounds = fromString(EngineCore.getProperty("physics.world_bounds", "-10000,-10000,-10000,10000,10000,10000"));
maxWorldObjectCount = EngineCore.getProperty("physics.max_world_object_count", 4096);
collisionConfiguration = new DefaultCollisionConfiguration();
dispatcher = new CollisionDispatcher(collisionConfiguration);
constraintSolver = new SequentialImpulseConstraintSolver();
//BroadphaseInterface broadphase = new DbvtBroadphase();
BroadphaseInterface broadphase = new AxisSweep3(worldBounds.getMin().toVecmathVec3f(), worldBounds.getMax().toVecmathVec3f(), maxWorldObjectCount);
seed = ((SequentialImpulseConstraintSolver)constraintSolver).getRandSeed();
world = new DiscreteDynamicsWorld(dispatcher, broadphase, constraintSolver, collisionConfiguration);
world.getBroadphase().getOverlappingPairCache().setInternalGhostPairCallback(new GhostPairCallback());
world.setGravity(new javax.vecmath.Vector3f(0,-9.82f,0.0f));
}
示例5: initializePhysics
import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration; //导入依赖的package包/类
protected void initializePhysics(){
// JBullet Stuff
DefaultCollisionConfiguration collisionConfiguration = new DefaultCollisionConfiguration();
CollisionDispatcher dispatcher = new CollisionDispatcher(
collisionConfiguration);
float bound = 800;
Vector3f worldAabbMin = new Vector3f(-bound, -bound, -bound);
Vector3f worldAabbMax = new Vector3f(bound, bound, bound);
int maxProxies = 5000;
AxisSweep3 overlappingPairCache =
new AxisSweep3(worldAabbMin, worldAabbMax, maxProxies);
BroadphaseInterface broadphase = new DbvtBroadphase();
SequentialImpulseConstraintSolver solver = new SequentialImpulseConstraintSolver();
world = new DiscreteDynamicsWorld(
dispatcher,overlappingPairCache, solver,
collisionConfiguration);
world.setGravity(new Vector3f(0, -9.8f, 0));
}
示例6: BulletPhysics
import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration; //导入依赖的package包/类
public BulletPhysics(WorldProvider world) {
collisionGroupManager = CoreRegistry.get(CollisionGroupManager.class);
_broadphase = new DbvtBroadphase();
_broadphase.getOverlappingPairCache().setInternalGhostPairCallback(new GhostPairCallback());
_defaultCollisionConfiguration = new DefaultCollisionConfiguration();
_dispatcher = new CollisionDispatcher(_defaultCollisionConfiguration);
_sequentialImpulseConstraintSolver = new SequentialImpulseConstraintSolver();
_discreteDynamicsWorld = new DiscreteDynamicsWorld(_dispatcher, _broadphase, _sequentialImpulseConstraintSolver, _defaultCollisionConfiguration);
_discreteDynamicsWorld.setGravity(new Vector3f(0f, -15f, 0f));
blockEntityRegistry = CoreRegistry.get(BlockEntityRegistry.class);
CoreRegistry.get(EventSystem.class).registerEventReceiver(this, BlockChangedEvent.class, BlockComponent.class);
PhysicsWorldWrapper wrapper = new PhysicsWorldWrapper(world);
VoxelWorldShape worldShape = new VoxelWorldShape(wrapper);
Matrix3f rot = new Matrix3f();
rot.setIdentity();
DefaultMotionState blockMotionState = new DefaultMotionState(new Transform(new Matrix4f(rot, new Vector3f(0, 0, 0), 1.0f)));
RigidBodyConstructionInfo blockConsInf = new RigidBodyConstructionInfo(0, blockMotionState, worldShape, new Vector3f());
RigidBody rigidBody = new RigidBody(blockConsInf);
rigidBody.setCollisionFlags(CollisionFlags.STATIC_OBJECT | rigidBody.getCollisionFlags());
_discreteDynamicsWorld.addRigidBody(rigidBody, combineGroups(StandardCollisionGroup.WORLD), (short)(CollisionFilterGroups.ALL_FILTER ^ CollisionFilterGroups.STATIC_FILTER));
}
示例7: PhysicsEngine
import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration; //导入依赖的package包/类
/**
* Initializes the JBullet physics engine. {@link #onResume()}, {@link #onPause()} and
* {@link #onDestroy()} have to be called from the corresponding life cycle methods. By default
* this is all handled by {@link de.fabmax.lightgl.GfxEngine} if physics simulation was enabled
* on engine creation.
*
* @see de.fabmax.lightgl.GfxEngine#GfxEngine(android.content.Context, boolean)
* @see de.fabmax.lightgl.GfxEngine#getPhysicsEngine()
*/
public PhysicsEngine() {
// init collision stuff
CollisionConfiguration collisionConfiguration = new DefaultCollisionConfiguration();
CollisionDispatcher dispatcher = new CollisionDispatcher(collisionConfiguration);
// maximum size of the collision world.
Vector3f worldAabbMin = new Vector3f(-100, -100, -100);
Vector3f worldAabbMax = new Vector3f(100, 100, 100);
BroadphaseInterface broadphase = new AxisSweep3(worldAabbMin, worldAabbMax);
SequentialImpulseConstraintSolver solver = new SequentialImpulseConstraintSolver();
mWorld = new DiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
mWorld.setGravity(new Vector3f(0, -G, 0));
}
示例8: PhysicsWorldJbullet
import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration; //导入依赖的package包/类
public PhysicsWorldJbullet(){
BroadphaseInterface broadphase=new DbvtBroadphase();
CollisionConfiguration collisionConfiguration=new DefaultCollisionConfiguration();
CollisionDispatcher dispatcher=new CollisionDispatcher(collisionConfiguration);
ConstraintSolver constraintSolver=new SequentialImpulseConstraintSolver();
bulletWorld=new DiscreteDynamicsWorld(dispatcher, broadphase, constraintSolver, collisionConfiguration);
setGravity(0, -9.81F, 0);
}
示例9: PhysicsEngine
import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration; //导入依赖的package包/类
public PhysicsEngine() {
broadphase = new DbvtBroadphase();
collisionConfiguration = new DefaultCollisionConfiguration();
dispatcher = new CollisionDispatcher(collisionConfiguration);
solver = new SequentialImpulseConstraintSolver();
dynamicsWorld = new DiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
dynamicsWorld.setGravity(new Vector3f(0, -9.81f, 0));
}
示例10: initWorld
import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration; //导入依赖的package包/类
protected void initWorld() {
BroadphaseInterface broadphase = new DbvtBroadphase();
DefaultCollisionConfiguration collisionConfiguration = new DefaultCollisionConfiguration();
CollisionDispatcher dispatcher = new CollisionDispatcher(
collisionConfiguration);
SequentialImpulseConstraintSolver solver = new SequentialImpulseConstraintSolver();
world = new DiscreteDynamicsWorld(dispatcher, broadphase, solver,
collisionConfiguration);
world.setGravity(new Vector3f(0, -1, 0));
groundShape = new StaticPlaneShape(new Vector3f(0, 1, 0), 1);
DefaultMotionState groundMotionState = new DefaultMotionState(
new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1),
new Vector3f(0, -1, 0), 1.0f)));
RigidBodyConstructionInfo groundRigidBodyCI = new RigidBodyConstructionInfo(
0, groundMotionState, groundShape, new Vector3f(0, 0, 0));
groundRigidBody = new RigidBody(groundRigidBodyCI);
world.addRigidBody(groundRigidBody);
dollOne = new RagDollShape(world, new Vector3f(0.0f, 30.0f, 0.0f), 5.0f);
dollTwo = new RagDollShape(world, new Vector3f(10.0f, 30.0f, 0.0f),
5.0f);
dollOne.setLinearSpeed(new Vector3f(30f, 0f, 0f));
dollTwo.setLinearSpeed(new Vector3f(-30f, 0f, 0f));
dollOne.saveState();
dollTwo.saveState();
}
示例11: initPhysics
import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration; //导入依赖的package包/类
public void initPhysics() {
// Setup the basic world
DefaultCollisionConfiguration collision_config = new DefaultCollisionConfiguration();
CollisionDispatcher dispatcher = new CollisionDispatcher(collision_config);
Vector3f worldAabbMin = new Vector3f(-10000, -10000, -10000);
Vector3f worldAabbMax = new Vector3f(10000, 10000, 10000);
BroadphaseInterface overlappingPairCache = new AxisSweep3(worldAabbMin, worldAabbMax);
//BroadphaseInterface overlappingPairCache = new SimpleBroadphase();
//#ifdef USE_ODE_QUICKSTEP
//btConstraintSolver* constraintSolver = new OdeConstraintSolver();
//#else
ConstraintSolver constraintSolver = new SequentialImpulseConstraintSolver();
//#endif
dynamicsWorld = new DiscreteDynamicsWorld(dispatcher, overlappingPairCache, constraintSolver, collision_config);
dynamicsWorld.setGravity(new Vector3f(0f, -30f, 0f));
dynamicsWorld.setDebugDrawer(new GLDebugDrawer(gl));
// Setup a big ground box
{
CollisionShape groundShape = new BoxShape(new Vector3f(200f, 10f, 200f));
Transform groundTransform = new Transform();
groundTransform.setIdentity();
groundTransform.origin.set(0f, -15f, 0f);
localCreateRigidBody(0f, groundTransform, groundShape);
}
// Spawn one ragdoll
spawnRagdoll();
clientResetScene();
}
示例12: initPhysics
import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration; //导入依赖的package包/类
public void initPhysics() {
// Setup the basic world
time = 0.0f;
cyclePeriod = 2000.0f; // in milliseconds
muscleStrength = 0.05f;
setCameraDistance(5.0f);
DefaultCollisionConfiguration collision_config = new DefaultCollisionConfiguration();
CollisionDispatcher dispatcher = new CollisionDispatcher(collision_config);
Vector3f worldAabbMin = new Vector3f(-10000,-10000,-10000);
Vector3f worldAabbMax = new Vector3f(10000,10000,10000);
BroadphaseInterface overlappingPairCache = new AxisSweep3(worldAabbMin, worldAabbMax);
//BroadphaseInterface overlappingPairCache = new SimpleBroadphase();
ConstraintSolver constraintSolver = new SequentialImpulseConstraintSolver();
dynamicsWorld = new DiscreteDynamicsWorld(dispatcher, overlappingPairCache, constraintSolver, collision_config);
// Setup a big ground box
{
CollisionShape groundShape = new BoxShape(new Vector3f(200f, 10f, 200f));
// TODO
//m_collisionShapes.push_back(groundShape);
Transform groundTransform = new Transform();
groundTransform.setIdentity();
groundTransform.origin.set(0f, -10f, 0f);
localCreateRigidBody(0f, groundTransform, groundShape);
}
// Spawn one TestRig
Vector3f startOffset = new Vector3f(1.0f, 0.5f, 0.0f);
spawnTestRig(startOffset, false);
startOffset.set(-2.0f, 0.5f, 0.0f);
spawnTestRig(startOffset, true);
clientResetScene();
}
示例13: initPhysics
import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration; //导入依赖的package包/类
public void initPhysics() throws Exception {
cameraUp.set(0f, 0f, 1f);
forwardAxis = 1;
setCameraDistance(22f);
// Setup a Physics Simulation Environment
collisionConfiguration = new DefaultCollisionConfiguration();
// btCollisionShape* groundShape = new btBoxShape(btVector3(50,3,50));
dispatcher = new CollisionDispatcher(collisionConfiguration);
Vector3f worldMin = new Vector3f(-1000f,-1000f,-1000f);
Vector3f worldMax = new Vector3f(1000f,1000f,1000f);
broadphase = new AxisSweep3(worldMin, worldMax);
//broadphase = new SimpleBroadphase();
//btOverlappingPairCache* broadphase = new btSimpleBroadphase();
solver = new SequentialImpulseConstraintSolver();
//ConstraintSolver* solver = new OdeConstraintSolver;
dynamicsWorld = new DiscreteDynamicsWorld(dispatcher,broadphase,solver,collisionConfiguration);
Vector3f gravity = new Vector3f();
gravity.negate(cameraUp);
gravity.scale(10f);
dynamicsWorld.setGravity(gravity);
new BspToBulletConverter().convertBsp(getClass().getResourceAsStream("exported.bsp.txt"));
clientResetScene();
}
示例14: initPhysics
import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration; //导入依赖的package包/类
public void initPhysics() {
// Setup the basic world
DefaultCollisionConfiguration collision_config = new DefaultCollisionConfiguration();
CollisionDispatcher dispatcher = new CollisionDispatcher(collision_config);
Vector3f worldAabbMin = new Vector3f(-10000, -10000, -10000);
Vector3f worldAabbMax = new Vector3f(10000, 10000, 10000);
//BroadphaseInterface overlappingPairCache = new AxisSweep3(worldAabbMin, worldAabbMax);
//BroadphaseInterface overlappingPairCache = new SimpleBroadphase();
BroadphaseInterface overlappingPairCache = new DbvtBroadphase();
//#ifdef USE_ODE_QUICKSTEP
//btConstraintSolver* constraintSolver = new OdeConstraintSolver();
//#else
ConstraintSolver constraintSolver = new SequentialImpulseConstraintSolver();
//#endif
dynamicsWorld = new DiscreteDynamicsWorld(dispatcher, overlappingPairCache, constraintSolver, collision_config);
dynamicsWorld.setGravity(new Vector3f(0f, -30f, 0f));
dynamicsWorld.setDebugDrawer(new GLDebugDrawer(gl));
// Setup a big ground box
{
CollisionShape groundShape = new BoxShape(new Vector3f(200f, 10f, 200f));
Transform groundTransform = new Transform();
groundTransform.setIdentity();
groundTransform.origin.set(0f, -15f, 0f);
localCreateRigidBody(0f, groundTransform, groundShape);
}
// Spawn one ragdoll
spawnRagdoll();
clientResetScene();
}
示例15: initPhysics
import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration; //导入依赖的package包/类
public void initPhysics() throws Exception {
cameraUp.set(0f, 0f, 1f);
forwardAxis = 1;
setCameraDistance(22f);
// Setup a Physics Simulation Environment
collisionConfiguration = new DefaultCollisionConfiguration();
// btCollisionShape* groundShape = new btBoxShape(btVector3(50,3,50));
dispatcher = new CollisionDispatcher(collisionConfiguration);
Vector3f worldMin = new Vector3f(-1000f,-1000f,-1000f);
Vector3f worldMax = new Vector3f(1000f,1000f,1000f);
//broadphase = new AxisSweep3(worldMin, worldMax);
//broadphase = new SimpleBroadphase();
broadphase = new DbvtBroadphase();
//btOverlappingPairCache* broadphase = new btSimpleBroadphase();
solver = new SequentialImpulseConstraintSolver();
//ConstraintSolver* solver = new OdeConstraintSolver;
dynamicsWorld = new DiscreteDynamicsWorld(dispatcher,broadphase,solver,collisionConfiguration);
Vector3f gravity = new Vector3f();
gravity.negate(cameraUp);
gravity.scale(10f);
dynamicsWorld.setGravity(gravity);
new BspToBulletConverter().convertBsp(getClass().getResourceAsStream("exported.bsp.txt"));
clientResetScene();
}