Physijs Load model three.js collisions don't work

£可爱£侵袭症+ 提交于 2019-12-08 00:57:48

问题


When I load my model(map) with JSONLoader I have a problem with collisions. If I load with BoxMesh it's work but the geometry collisions is like a cube, and my model is not a cube, the middle of my model is empty. And I put an other object (cube) on the top of my map the object stop on the top of this map not inside.

After search, I have load my model with Convex, and the object ont the top , fall on the plane of my map but I think the size (40) is not load correctly because if I move the object very little he fall in the space.

I load my model like this:

 var loader = new THREE.JSONLoader();
 loader.load( "essai/lobby3.js", function( lobby_geometry, lobby_materials ) {
 console.log(lobby_geometry);
 var ground_material = Physijs.createMaterial(
            new THREE.MeshFaceMaterial(lobby_materials),
            .8, // high friction
            0 // low restitution
        );

    mesh = new Physijs.Mesh ( //I try with BoxMesh / Convex / Concav
                    lobby_geometry,
                    ground_material,
                    0
                );
       mesh.scale.set(40,40,40);
       scene.add(mesh);    
});

I don't know if it's very easy to understand the problem.

BoxMesh: Here the object is stop.

Convex: Don't detect collisions

I upload my tests, I think maybe is better to undestand : http://www.hebergeurfichier.com/download/a97e3ae31c36dfe98525213cde90165f.html

PS: I create my models with blender and export in three.js extension.

来源:https://stackoverflow.com/questions/20355354/physijs-load-model-three-js-collisions-dont-work

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!