Search in sources :

Example 1 with TriangleIndexVertexArray

use of com.bulletphysics.collision.shapes.TriangleIndexVertexArray in project jmonkeyengine by jMonkeyEngine.

the class GImpactCollisionShape method createShape.

protected void createShape() {
    bulletMesh = new IndexedMesh();
    bulletMesh.numVertices = numVertices;
    bulletMesh.numTriangles = numTriangles;
    bulletMesh.vertexStride = vertexStride;
    bulletMesh.triangleIndexStride = triangleIndexStride;
    bulletMesh.triangleIndexBase = triangleIndexBase;
    bulletMesh.vertexBase = vertexBase;
    bulletMesh.triangleIndexBase = triangleIndexBase;
    TriangleIndexVertexArray tiv = new TriangleIndexVertexArray(numTriangles, triangleIndexBase, triangleIndexStride, numVertices, vertexBase, vertexStride);
    cShape = new GImpactMeshShape(tiv);
    cShape.setLocalScaling(Converter.convert(worldScale));
    ((GImpactMeshShape) cShape).updateBound();
    cShape.setLocalScaling(Converter.convert(getScale()));
    cShape.setMargin(margin);
}
Also used : GImpactMeshShape(com.bulletphysics.extras.gimpact.GImpactMeshShape) TriangleIndexVertexArray(com.bulletphysics.collision.shapes.TriangleIndexVertexArray) IndexedMesh(com.bulletphysics.collision.shapes.IndexedMesh)

Example 2 with TriangleIndexVertexArray

use of com.bulletphysics.collision.shapes.TriangleIndexVertexArray in project jmonkeyengine by jMonkeyEngine.

the class MeshCollisionShape method createShape.

protected void createShape() {
    bulletMesh = new IndexedMesh();
    bulletMesh.numVertices = numVertices;
    bulletMesh.numTriangles = numTriangles;
    bulletMesh.vertexStride = vertexStride;
    bulletMesh.triangleIndexStride = triangleIndexStride;
    bulletMesh.triangleIndexBase = triangleIndexBase;
    bulletMesh.vertexBase = vertexBase;
    bulletMesh.triangleIndexBase = triangleIndexBase;
    TriangleIndexVertexArray tiv = new TriangleIndexVertexArray(numTriangles, triangleIndexBase, triangleIndexStride, numVertices, vertexBase, vertexStride);
    cShape = new BvhTriangleMeshShape(tiv, true);
    cShape.setLocalScaling(Converter.convert(getScale()));
    cShape.setMargin(margin);
}
Also used : BvhTriangleMeshShape(com.bulletphysics.collision.shapes.BvhTriangleMeshShape) TriangleIndexVertexArray(com.bulletphysics.collision.shapes.TriangleIndexVertexArray) IndexedMesh(com.bulletphysics.collision.shapes.IndexedMesh)

Aggregations

IndexedMesh (com.bulletphysics.collision.shapes.IndexedMesh)2 TriangleIndexVertexArray (com.bulletphysics.collision.shapes.TriangleIndexVertexArray)2 BvhTriangleMeshShape (com.bulletphysics.collision.shapes.BvhTriangleMeshShape)1 GImpactMeshShape (com.bulletphysics.extras.gimpact.GImpactMeshShape)1