I am trying to simulate soft body in a softRigidworld of bullet but I am doing that in libgdx I have added the soft body to the dynamic world and set up gravity as 0 but the soft body which is a cloth always goes down like gravity is -9.8 Why is that happening ? any helps ?

this is the image: https://drive.google.com/file/d/1-9Bnwz5wy_rkiIsvjD9wGzVw-7DY8SgB/view?usp=sharing

I have tried to add a rigid body to that world and that body is reacting to gravity but not the soft body.

used this to set up the world and gravity

collisionConfiguration = new btSoftBodyRigidBodyCollisionConfiguration();
        dispatcher = new btCollisionDispatcher(collisionConfiguration);
        broadphase = new btAxisSweep3(new Vector3(-1000, -1000, -1000), new Vector3(1000, 1000, 1000), 1024);
        solver = new btSequentialImpulseConstraintSolver();
        dynamicsWorld = new btSoftRigidDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);

        worldInfo = new btSoftBodyWorldInfo();
        worldInfo.setBroadphase(broadphase);
        worldInfo.setDispatcher(dispatcher);
        worldInfo.getSparsesdf().Initialize();

        dynamicsWorld.setGravity(new Vector3(0f, 0f, 0));

used this https://github.com/libgdx/libgdx/blob/master/tests/gdx-tests/src/com/badlogic/gdx/tests/bullet/SoftBodyTest.java to add soft body

and rendered it using

final float delta = Math.min(1f / 30f, Gdx.graphics.getDeltaTime());
        dynamicsWorld.stepSimulation(delta, 5, 1f / 30f);
1

There are 1 best solutions below

0
On

Found it. Needed to add the gravity to the worldinfo as well.

worldInfo.setGravity(new btVector3(0,9.8f,0));