Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't seem to make Ammo.btConvexTriangleMeshShape work properly #23

Open
JesseKirschner opened this issue May 5, 2012 · 2 comments
Open

Comments

@JesseKirschner
Copy link

The title says it all.
Although there is some dynamics (an object falls), all the rest is simply not happening (interaction with other objects in a normal way).

this is my code:

var triTransform = new Ammo.btTransform();
triTransform.setIdentity();
triTransform.setOrigin(new Ammo.btVector3(0, 3, 0));

var verti = [];

verti[0] = new Ammo.btVector3(-1.5, -.612, -.866);
verti[1] = new Ammo.btVector3(1.5, -.612, -.866);
verti[2] = new Ammo.btVector3(0, -.612, 1.732);
verti[3] = new Ammo.btVector3(0, 1.837, 0);

verti[0] = new Ammo.btVector3(0, 0, 0);
verti[1] = new Ammo.btVector3(1, 0, 0);
verti[2] = new Ammo.btVector3(.5, 0, 1);
verti[3] = new Ammo.btVector3(.5, 4, .5);

var triMesh = new Ammo.btTriangleMesh();

triMesh.addTriangle(verti[0], verti[1], verti[2], true);
triMesh.addTriangle(verti[1], verti[0], verti[3], true);
triMesh.addTriangle(verti[2], verti[1], verti[3], true);
triMesh.addTriangle(verti[0], verti[2], verti[3], true);

var triShape = new Ammo.btConvexTriangleMeshShape(triMesh, true);

this.shape1 = this.localCreateRigidBody(1, triTransform, triShape);

I am programming this in an environment made by schteppe (big ups for that really nice environment) so the motionstate and rigidbody are created in localCreateRigidBody, where a THREE object is linked to this as well.

In the C++ bullet written examples I see them using btHullShape when using the convextrianglemeshshape, this hullshape is missing in Ammo. Maybe this is where the problem lies? Elsewise I am lost...

Greetings Jesse

@dataexcess
Copy link

Try using btBvhTriangleMeshShape instead. I had similar issues. some shapes require to work with btBvhTriangleMeshShape and other with btConvexTriangleMeshShape. Those are my finsings in any case...

@suddenly4
Copy link

suddenly4 commented Dec 18, 2024

As an option make your shapes - btTriangleMesh then if you want add to btConvexTriangleMeshShape and then btCompoundShape, this object make collided is correct vs any objects including btBvhTriangleMeshShape or btConvexTriangleMeshShape

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants