예제 #1
0
 internal static HandleRef getCPtr(btDefaultCollisionConfiguration obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
 internal static HandleRef getCPtr(btDefaultCollisionConfiguration obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
예제 #3
0
    void CreateDiscreteDynamicsWorld()
    {
        btVector3 gravityVec = new btVector3(Gravity.x, Gravity.y, Gravity.z);
        ///collision configuration contains default setup for memory, collision setup. Advanced users can create their own configuration.
        collisionConfiguration = new btDefaultCollisionConfiguration();

        ///use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded)
        dispatcher = new btCollisionDispatcher(collisionConfiguration.GetSwigPtr());

        ///btDbvtBroadphase is a good general purpose broadphase. You can also try out btAxis3Sweep.
        overlappingPairCache = new btDbvtBroadphase();

        ///the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
        solver = new btSequentialImpulseConstraintSolver();

        dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher.GetSwigPtr(), overlappingPairCache.GetSwigPtr(), solver.GetSwigPtr(), collisionConfiguration.GetSwigPtr());

        SWIGTYPE_p_btCollisionWorld collisionWorldPtr = dynamicsWorld.getCollisionWorld();
        collisionWorld = btCollisionWorld.GetObjectFromSwigPtr(collisionWorldPtr);

        dynamicsWorld.setGravity(gravityVec.GetSwigPtr());

        AddBulletObjects();
    }