Hi all,
I am having trouble obtaining collisions from a GeomTriMesh. If the GeomTriMesh is static, then collisions occur fine. However, if it is dynamic, no collisions with the trimesh take place.
The code for static is:
Vector3f verts[] = geo.getVertices();
float geomVerts[] = new float[verts.length * 3];
int c = 0;
for (int i = 0; i < verts.length; i++) {
geomVerts[c] = verts[i].x;
geomVerts[c + 1] = verts[i].y;
geomVerts[c + 2] = verts[i].z;
c += 3;
}
GeomTriMesh tMesh = new GeomTriMesh(geo.getName(), geomVerts,
((TriMesh) geo).getIndices());
space.add(tMesh);
tMesh.setPosition(geo.getLocalTranslation().x, geo
.getLocalTranslation().y, geo.getLocalTranslation().z);
tMesh.setAxisAndAngle(geo.getLocalRotation().x, geo
.getLocalRotation().y, geo.getLocalRotation().z, geo
.getLocalRotation().w);
And the code for dynamic is:
Vector3f verts[] = geo.getVertices();
float geomVerts[] = new float[verts.length * 3];
int c = 0;
for (int i = 0; i < verts.length; i++) {
geomVerts[c] = verts[i].x;
geomVerts[c + 1] = verts[i].y;
geomVerts[c + 2] = verts[i].z;
c += 3;
}
GeomTriMesh tMesh = new GeomTriMesh(geo.getName(), geomVerts,
((TriMesh) geo).getIndices());
Body body = new Body(geo.getName(), world, tMesh);
space.addBodyGeoms(body);
body.setPosition(geo.getLocalTranslation().x, geo
.getLocalTranslation().y, geo.getLocalTranslation().z);
body.setAxisAndAngle(geo.getLocalRotation().x, geo
.getLocalRotation().y, geo.getLocalRotation().z, geo
.getLocalRotation().w);
body.adjustMass(mass);
any assistance on this matter is appreciated.