SoftBody is slipping through RigidBody.

Post Reply
Posts: 1
Joined: Tue Sep 24, 2019 3:59 pm

SoftBody is slipping through RigidBody.

Post by uknown_user123 » Tue Sep 24, 2019 4:24 pm

Hey guys,
I've recently started doing stuff with bullet and can't figure out something.

I have got a simple soft body (a square patch) and a mesh that I load myself with tiny_obj_loader. I throw the patch on the mesh and expect it to get stuck on top of it.

Here's what I get: ...

I can see that there's some kind of collision, since the patch is being pulled up a bit in the center when it goes through the mesh.
When I use the box primitive instead of a mesh, everything works fine.

So, here's the question:
How do I create a mesh properly and what am I doing wrong?

Code: Select all

    btTriangleMesh* triangleMeshTerrain = new btTriangleMesh();
    // here I parse the .obj file and add triangles via 'triangleMeshTerrain->addTriangle(vertex1, vertex2, vertex3);'
    btCollisionShape* collisionShapeTerrain = new btBvhTriangleMeshShape(triangleMeshTerrain, true);

    btTransform meshTransform;
    meshTransform.setOrigin(btVector3(0.0, 0.0, 0.0));
    btDefaultMotionState* motionState = new btDefaultMotionState(meshTransform);

    btRigidBody::btRigidBodyConstructionInfo rigidBodyConstructionInfo(0.0f, motionState, collisionShapeTerrain, btVector3(0.0, 0.0, 0.0));
    btRigidBody* rigidBodyTerrain = new btRigidBody(rigidBodyConstructionInfo);

I believe the mesh is alright and I parse it correctly, since it's rendered okay.


Post Reply