kripken / ammo.js

Direct port of the Bullet physics engine to JavaScript using Emscripten

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sbConfig.set_collisions()

sdarpeng opened this issue · comments

                const softBodyHelpers = new Ammo.btSoftBodyHelpers();
                const clothCorner00 = new Ammo.btVector3( clothPos.x, clothPos.y + clothHeight, clothPos.z );
                const clothCorner01 = new Ammo.btVector3( clothPos.x, clothPos.y + clothHeight, clothPos.z - clothWidth );
                const clothCorner10 = new Ammo.btVector3( clothPos.x, clothPos.y, clothPos.z );
                const clothCorner11 = new Ammo.btVector3( clothPos.x, clothPos.y, clothPos.z - clothWidth );
                const clothSoftBody = softBodyHelpers.CreatePatch( physicsWorld.getWorldInfo(), clothCorner00, clothCorner01, clothCorner10, clothCorner11, clothNumSegmentsZ + 1, clothNumSegmentsY + 1, 0, true );
                const sbConfig = clothSoftBody.get_m_cfg();
                clothSoftBody.generateClusters(40,80);
                sbConfig.set_viterations( 10 );
                sbConfig.set_piterations( 20 );
                clothSoftBody.setTotalMass( 1, false );
                sbConfig.set_collisions(0x0001);

on the bullet src, I found the following options ot the set_collisions() like this.

        RVSmask    =    0x000f,    ///Rigid versus soft mask
        SDF_RS    =    0x0001,    ///SDF based rigid vs soft
        CL_RS    =    0x0002, ///Cluster vs convex rigid vs soft

        SVSmask    =    0x0030,    ///Rigid versus soft mask        
        VF_SS    =    0x0010,    ///Vertex vs face soft vs soft handling
        CL_SS    =    0x0020, ///Cluster vs cluster soft vs soft handling
        CL_SELF =    0x0040, ///Cluster soft body self collision
        /* presets    */ 
        Default    =    SDF_RS,

While I tried all the options, I found only default SDF_RS and CL_RS works, other option doesn't work. Do somebody know why?