schteppe / cannon.js

A lightweight 3D physics engine written in JavaScript.
http://schteppe.github.com/cannon.js
MIT License
4.71k stars 710 forks source link

Calculate indices from JSON mesh data #343

Open Jabarnes01 opened 7 years ago

Jabarnes01 commented 7 years ago

Hello,

Having trouble understanding how to pass the second parameter (indices) of the cannon.trimesh( ) class. I have a JSON file exported from blender with the following object properties.

"faces": [ ],
"vertices": [ ],
"metadata": { },
"uvs": [ ],
"normals": [ ],
"colors": [ ],
"materials": [ { } ] 

How do you calculate the indices so it can be passed into cannon.trimesh( )? Assuming you triangulated the blender mesh before exporting it to three.js JSON so that the entire mesh is tri's instead of quads.

Jabarnes01 commented 7 years ago

Could I texture a height field with a seamless tiled image?