SHARE
TWEET

Untitled

a guest Sep 6th, 2014 226 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int i_num = mdl_collisionmesh.meshes.get(0).getNumIndices();
  2.  
  3. short[] indices = new short[i_num];
  4.                
  5. mdl_collisionmesh.meshes.get(0).getIndices(indices);
  6.                        
  7. int v_num = mdl_collisionmesh.meshes.get(0).getNumVertices();
  8.                
  9. float[] vertices = new float[9999];
  10.                
  11. mdl_collisionmesh.meshes.get(0).getVertices(vertices);
  12.                        
  13. int floatsPerVertex = mdl_collisionmesh.meshes.get(0).getVertexSize() / 4;
  14.                        
  15. for(int i = 0; i < i_num; i = i + floatsPerVertex*3) {  
  16.                
  17.         Vector3 vertex = new Vector3(0f,0f,0f);
  18.                        
  19.         vertex.x = vertices[i + 0];
  20.         vertex.y = vertices[i + 1];
  21.         vertex.z = vertices[i + 2];
  22.         //I have 3 variables for vector3 coordinates that i use(p1,p2,p3) to make triangles                    
  23.         p1 = new Vector3(vertex.x,vertex.y,vertex.z);
  24.                        
  25.         vertex.x = vertices[i + floatsPerVertex + 0];
  26.         vertex.y = vertices[i + floatsPerVertex + 1];
  27.         vertex.z = vertices[i + floatsPerVertex + 2];          
  28.         p2 = new Vector3(vertex.x,vertex.y,vertex.z);
  29.                        
  30.         vertex.x = vertices[i + floatsPerVertex * 2 + 0];
  31.         vertex.y = vertices[i + floatsPerVertex * 2 + 1];
  32.         vertex.z = vertices[i + floatsPerVertex * 2 + 2];              
  33.         p3 = new Vector3(vertex.x,vertex.y,vertex.z);
  34.  
  35.         createTriangle(p1, p2, p3);
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top