Bullet Wrapper Triangle callbacks

Anything libgdx related goes here!

Bullet Wrapper Triangle callbacks

Postby Rolandinho » Fri May 03, 2019 11:43 am

Issue details
I would like to create my own TriangleIndexCallback. However, with the callback function
    internalProcessTriangleIndex(btVector3 triangle, int partId, int triangleIndex)
I only get the first vector of the triangles. Is it possible to customize the bullet wrapper to pass an array (or a List) with all three vectors of the triangle?
e.g.
    internalProcessTriangleIndex(btVector3[] triangle, int partId, int triangleIndex)

Reproduction steps/code
Code: Select all
public class CustomInternalTriangleIndexCallback extends btInternalTriangleIndexCallback {

   @Override
   public void internalProcessTriangleIndex(btVector3 triangle, int partId, int triangleIndex) {
      Vector3 v0 = new Vector3(triangle.getFloats());
      System.out.println(triangleIndex + ": " + v0);
   }

   public static void main(String[] args) {
      LibGDXLoader libgdxLoader = new LibGDXLoader();
      libgdxLoader.loadAll();

      btTriangleMesh triangleMesh = new btTriangleMesh();
      triangleMesh.addTriangle(new Vector3(0, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 2, 0));
      triangleMesh.addTriangle(new Vector3(1, 0, 0), new Vector3(1, 1, 0), new Vector3(1, 2, 0));
      triangleMesh.addTriangle(new Vector3(2, 0, 0), new Vector3(2, 1, 0), new Vector3(2, 2, 0));

      MyInternalTriangleIndexCallback callback = new MyInternalTriangleIndexCallback();
      Vector3 aabbMin = new Vector3();
      Vector3 aabbMax = new Vector3(2, 2, 2);
      triangleMesh.InternalProcessAllTriangles(callback, aabbMin, aabbMax);
   }

}

    0: (0.0,0.0,0.0)
    1: (1.0,0.0,0.0)
    2: (2.0,0.0,0.0)

Version of LibGDX and/or relevant dependencies
1.9.10

Please select the affected platforms
[ x] Linux
Rolandinho
 
Posts: 1
Joined: Fri May 03, 2019 11:36 am

Return to Libgdx

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest