Initialize() публичный Метод

public Initialize ( ) : void
Результат void
Пример #1
0
    void CreateSoftDynamicsWorld()
    {
        btVector3 gravityVec = new btVector3(Gravity.x, Gravity.y, Gravity.z);
        btCollisionObject tempObject = new btCollisionObject();
        btConstraintSetting tempObject2 = new btConstraintSetting();

        softBodyWorldInfo = new btSoftBodyWorldInfo();
        ///collision configuration contains default setup for memory, collision setup. Advanced users can create their own configuration.
        softCollisionConfiguration = new btSoftBodyRigidBodyCollisionConfiguration();

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

        btVector3 worldAabbMin = new btVector3(-1000,-1000,-1000);
        btVector3 worldAabbMax = new btVector3(1000,1000,1000);

        axisBroadphase = new btAxisSweep3(worldAabbMin.GetSwigPtr(),worldAabbMax.GetSwigPtr(),32766);
        softBodyWorldInfo.m_broadphase = axisBroadphase.GetSwigPtr();
        ///the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
        solver = new btSequentialImpulseConstraintSolver();

        softDynamicsWorld = new btSoftRigidDynamicsWorld(dispatcher.GetSwigPtr(), axisBroadphase.GetSwigPtr(), solver.GetSwigPtr(), softCollisionConfiguration.GetSwigPtr());
        dynamicsWorld = btDiscreteDynamicsWorld.GetObjectFromSwigPtr(softDynamicsWorld.getDiscreteDynamicsWorld());
        SWIGTYPE_p_btCollisionWorld collisionWorldPtr = dynamicsWorld.getCollisionWorld();
        collisionWorld = btCollisionWorld.GetObjectFromSwigPtr(collisionWorldPtr);
        dynamicsWorld.setGravity(gravityVec.GetSwigPtr());
        softBodyWorldInfo.m_gravity = gravityVec.GetSwigPtr();
        btVector3 water_nomalVec = new btVector3(0,0,0);
        softBodyWorldInfo.air_density		=	1.2f;
        softBodyWorldInfo.water_density	    =	0;
        softBodyWorldInfo.water_offset		=	0;
        softBodyWorldInfo.water_normal		=	water_nomalVec.GetSwigPtr();
        sparseSdf = softBodyWorldInfo.m_sparsesdf;
        sparseSdf.Initialize();
        AddBulletObjects();
    }