How can i add physics on a blender model ? I tried ConvexMesh, ConcaveMesh but no luck.
var mesh = {... blender exporter ...}
var loader = new THREE.JSONLoader();
var mesh_obj = loader.parse(mesh,'./');
var mesh_materials = mesh_obj.materials;
var mesh_geometry = mesh_obj.geometry;
var _materials=[];
for ( var i = 0, i<mesh_materials.length;i ++ ) {
var materialv = Physijs.createMaterial(mesh_materials[i],0.8,0.1);
_materials.push(materialv)
}
mesh = new Physijs.ConcaveMesh(mesh_geometry, new THREE.MeshFaceMaterial(_materials),0 );
scene.add(mesh)
Maybe an old question but I had the same issue and opted for wrapping up the model in a
BoxMesh
"container" and adding the model as a child of the container. Below I have an example with a track model I used. Then set the child's position so that it is inside the Mesh. For more complex models I'm guessing an approach would be to encapsulate the individual geometries with other Physijs shapes.You can see an example of my code using the track model I described with the wireframe around to see the container.