hi,
i'm doing a project in threejs and i have some issues one of this is :
i load a object with OBJMTLLoader and i apply it some skills where all it's ok, but when i must apply the physics to my object with the PHISYJS library i can't apply it to my object, i tried to added my object to the boxMesh and do it invisible but i do not have the results.
post part of my code so if there is any way to do it:
`var animation = false;
var parent = new THREE.Object3D();
var box;
var loader = new THREE.OBJMTLLoader();
<!-- Carico il modello per rappresentare l'aereo -->
var load = function(object){
mesh = object;
mesh.scale.set(0.6,0.6,0.6);
mesh.position.set(0,-4,-6.6);
mesh.rotation.x = 0
mesh.rotation.y = -3.125;
mesh.rotation.z = 0;
mesh.castShadow = true;
var propeller = new Array();
for(var e in mesh.children){
if(mesh.children[e].name==="prop01_Cube") {
propeller[0]=e;
}
if(mesh.children[e].name==="prop02_Cube"){
propeller[1]=e;
}
if(mesh.children[e].name==="prop_tip01_Cylinder.001"){
propeller[2]=e;
}
}
var center = mesh.children[propeller[2]];
center.children[0].geometry.center();
var propeller1 = mesh.children[propeller[0]];
propeller1.children[0].geometry.center();
//aggancio la prima parte dell'elica al centro
propeller1.children[0].geometry.translate(-0.4,0.3,-0.15);
var propeller2 = mesh.children[propeller[1]];
propeller2.children[0].geometry.center();
//aggancio la seconda parte dell'elica al centro
propeller2.children[0].geometry.translate(0.4,-0.25,0.10);
center.add(propeller1);
center.add(propeller2);
//scene.add(parent);
parent.add(center);
parent.rotation.set(0,-3.125,0);
parent.position.set(0,-3.30,-8.50);
object3D.add(mesh);
object3D.add(parent);
animation=true;
var phisyGem = new THREE.CubeGeometry( 10, 10, 10 );
var phisyMaterial = new Physijs.createMaterial(new THREE.MeshBasicMaterial(),
.8, //high friction
.3 //low restitution
);
phisyMaterial.visible = true;
box= new Physijs.BoxMesh(
phisyGem,
phisyMaterial,
0//mass
);
box.position.set(0,-4,-6.6);
box.add(object3D);
scene.add(box);
};
loader.load('models/ProvaPropeller_obj/provaPropeller2.obj','models/ProvaPropeller_obj/provaPropeller2.mtl', load);`
hi, i'm doing a project in threejs and i have some issues one of this is : i load a object with OBJMTLLoader and i apply it some skills where all it's ok, but when i must apply the physics to my object with the PHISYJS library i can't apply it to my object, i tried to added my object to the boxMesh and do it invisible but i do not have the results. post part of my code so if there is any way to do it: `var animation = false; var parent = new THREE.Object3D(); var box;
thanks a lot for any response.