Search in sources :

Example 1 with AxisSweep3

use of com.bulletphysics.collision.broadphase.AxisSweep3 in project jmonkeyengine by jMonkeyEngine.

the class PhysicsSpace method create.

/**
     * Has to be called from the (designated) physics thread
     */
public void create() {
    pQueueTL.set(pQueue);
    collisionConfiguration = new DefaultCollisionConfiguration();
    dispatcher = new CollisionDispatcher(collisionConfiguration);
    switch(broadphaseType) {
        case SIMPLE:
            broadphase = new SimpleBroadphase();
            break;
        case AXIS_SWEEP_3:
            broadphase = new AxisSweep3(Converter.convert(worldMin), Converter.convert(worldMax));
            break;
        case AXIS_SWEEP_3_32:
            broadphase = new AxisSweep3_32(Converter.convert(worldMin), Converter.convert(worldMax));
            break;
        case DBVT:
            broadphase = new DbvtBroadphase();
            break;
    }
    solver = new SequentialImpulseConstraintSolver();
    dynamicsWorld = new DiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
    dynamicsWorld.setGravity(new javax.vecmath.Vector3f(0, -9.81f, 0));
    broadphase.getOverlappingPairCache().setInternalGhostPairCallback(new GhostPairCallback());
    GImpactCollisionAlgorithm.registerAlgorithm(dispatcher);
    physicsSpaceTL.set(this);
    //register filter callback for tick / collision
    setTickCallback();
    setContactCallbacks();
    //register filter callback for collision groups
    setOverlapFilterCallback();
}
Also used : DiscreteDynamicsWorld(com.bulletphysics.dynamics.DiscreteDynamicsWorld) GhostPairCallback(com.bulletphysics.collision.dispatch.GhostPairCallback) AxisSweep3_32(com.bulletphysics.collision.broadphase.AxisSweep3_32) SimpleBroadphase(com.bulletphysics.collision.broadphase.SimpleBroadphase) SequentialImpulseConstraintSolver(com.bulletphysics.dynamics.constraintsolver.SequentialImpulseConstraintSolver) CollisionDispatcher(com.bulletphysics.collision.dispatch.CollisionDispatcher) AxisSweep3(com.bulletphysics.collision.broadphase.AxisSweep3) DbvtBroadphase(com.bulletphysics.collision.broadphase.DbvtBroadphase) DefaultCollisionConfiguration(com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration)

Aggregations

AxisSweep3 (com.bulletphysics.collision.broadphase.AxisSweep3)1 AxisSweep3_32 (com.bulletphysics.collision.broadphase.AxisSweep3_32)1 DbvtBroadphase (com.bulletphysics.collision.broadphase.DbvtBroadphase)1 SimpleBroadphase (com.bulletphysics.collision.broadphase.SimpleBroadphase)1 CollisionDispatcher (com.bulletphysics.collision.dispatch.CollisionDispatcher)1 DefaultCollisionConfiguration (com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration)1 GhostPairCallback (com.bulletphysics.collision.dispatch.GhostPairCallback)1 DiscreteDynamicsWorld (com.bulletphysics.dynamics.DiscreteDynamicsWorld)1 SequentialImpulseConstraintSolver (com.bulletphysics.dynamics.constraintsolver.SequentialImpulseConstraintSolver)1