本文整理汇总了Java中com.bulletphysics.collision.broadphase.AxisSweep3类的典型用法代码示例。如果您正苦于以下问题:Java AxisSweep3类的具体用法?Java AxisSweep3怎么用?Java AxisSweep3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AxisSweep3类属于com.bulletphysics.collision.broadphase包,在下文中一共展示了AxisSweep3类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initialize
import com.bulletphysics.collision.broadphase.AxisSweep3; //导入依赖的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));
}
开发者ID:Axodoss,项目名称:Wicken,代码行数:22,代码来源:PhysicsSystem.java
示例2: initializePhysics
import com.bulletphysics.collision.broadphase.AxisSweep3; //导入依赖的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));
}
开发者ID:seemywingz,项目名称:Kengine,代码行数:19,代码来源:Scene.java
示例3: PhysicsEngine
import com.bulletphysics.collision.broadphase.AxisSweep3; //导入依赖的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));
}
开发者ID:fabmax,项目名称:LightGL,代码行数:25,代码来源:PhysicsEngine.java
示例4: initPhysics
import com.bulletphysics.collision.broadphase.AxisSweep3; //导入依赖的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();
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:38,代码来源:GenericJointDemo.java
示例5: initPhysics
import com.bulletphysics.collision.broadphase.AxisSweep3; //导入依赖的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();
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:41,代码来源:DynamicControlDemo.java
示例6: initPhysics
import com.bulletphysics.collision.broadphase.AxisSweep3; //导入依赖的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();
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:30,代码来源:BspDemo.java
示例7: initPhysics
import com.bulletphysics.collision.broadphase.AxisSweep3; //导入依赖的package包/类
public void initPhysics() throws Exception {
CollisionShape groundShape = new BoxShape(new Vector3f(50, 3, 50));
collisionShapes.add(groundShape);
collisionConfiguration = new DefaultCollisionConfiguration();
dispatcher = new CollisionDispatcher(collisionConfiguration);
Vector3f worldMin = new Vector3f(-1000f,-1000f,-1000f);
Vector3f worldMax = new Vector3f(1000f,1000f,1000f);
AxisSweep3 sweepBP = new AxisSweep3(worldMin, worldMax);
overlappingPairCache = sweepBP;
constraintSolver = new SequentialImpulseConstraintSolver();
dynamicsWorld = new DiscreteDynamicsWorld(dispatcher,overlappingPairCache,constraintSolver,collisionConfiguration);
Transform startTransform = new Transform();
startTransform.setIdentity();
startTransform.origin.set(0.0f, 4.0f, 0.0f);
ghostObject = new PairCachingGhostObject();
ghostObject.setWorldTransform(startTransform);
sweepBP.getOverlappingPairCache().setInternalGhostPairCallback(new GhostPairCallback());
float characterHeight = 1.75f * characterScale;
float characterWidth = 1.75f * characterScale;
ConvexShape capsule = new CapsuleShape(characterWidth, characterHeight);
ghostObject.setCollisionShape(capsule);
ghostObject.setCollisionFlags(CollisionFlags.CHARACTER_OBJECT);
float stepHeight = 0.35f * characterScale;
character = new KinematicCharacterController(ghostObject, capsule, stepHeight);
new BspToBulletConverter().convertBsp(getClass().getResourceAsStream("/com/bulletphysics/demos/bsp/exported.bsp.txt"));
dynamicsWorld.addCollisionObject(ghostObject, CollisionFilterGroups.CHARACTER_FILTER, (short)(CollisionFilterGroups.STATIC_FILTER | CollisionFilterGroups.DEFAULT_FILTER));
dynamicsWorld.addAction(character);
clientResetScene();
setCameraDistance(56f);
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:41,代码来源:CharacterDemo.java
示例8: PhysicsWorldJBullet
import com.bulletphysics.collision.broadphase.AxisSweep3; //导入依赖的package包/类
public PhysicsWorldJBullet(boolean gravity){
// collision configuration contains default setup for memory, collision
// setup. Advanced users can create their own configuration.
CollisionConfiguration collisionConfiguration = new DefaultCollisionConfiguration();
// use the default collision dispatcher. For parallel processing you
// can use a diffent dispatcher (see Extras/BulletMultiThreaded)
CollisionDispatcher dispatcher = new CollisionDispatcher(collisionConfiguration);
// the maximum size of the collision world. Make sure objects stay
// within these boundaries
// Don't make the world AABB size too large, it will harm simulation
// quality and performance
Vector3f worldAabbMin = new Vector3f(-10000, -10000, -10000);
Vector3f worldAabbMax = new Vector3f(10000, 10000, 10000);
int maxProxies = 1024;
AxisSweep3 overlappingPairCache = new AxisSweep3(worldAabbMin, worldAabbMax, maxProxies);
SequentialImpulseConstraintSolver solver = new SequentialImpulseConstraintSolver();
dynamicsWorld = new DiscreteDynamicsWorld(
dispatcher, overlappingPairCache, solver,
collisionConfiguration);
if(gravity == true){
dynamicsWorld.setGravity(new Vector3f(0.0f,0.0f,-9.81f));
}
else{
dynamicsWorld.setGravity(new Vector3f(0.0f,0.0f,0.0f));
}
}
开发者ID:gama-platform,项目名称:gama,代码行数:34,代码来源:PhysicsWorldJBullet.java
示例9: init
import com.bulletphysics.collision.broadphase.AxisSweep3; //导入依赖的package包/类
public void init()
{
collisionConfiguration = new DefaultCollisionConfiguration();
dispatcher = new CollisionDispatcher(collisionConfiguration);
Vector3f worldAabbMin = new Vector3f(-1000000, -1000000, -1000000);
Vector3f worldAabbMax = new Vector3f(1000000, 1000000, 1000000);
AxisSweep3 overlappingPairCache = new AxisSweep3(worldAabbMin, worldAabbMax);
SequentialImpulseConstraintSolver solver = new SequentialImpulseConstraintSolver();
world = new DiscreteDynamicsWorld(dispatcher, overlappingPairCache, solver, collisionConfiguration);
world.setGravity(toBullet(Vector3.get(0, -9.81f, 0)));
}
开发者ID:jglrxavpok,项目名称:jglrEngine,代码行数:13,代码来源:PhysicsEngine.java
注:本文中的com.bulletphysics.collision.broadphase.AxisSweep3类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论