Hi There,
I load a model like so:
var boidLoad = assetsManager.addMeshTask(
"skull task",
"",
"https://cdn.glitch.com/6275d7c2-459a-4c97-a67e-c45c4e56e749%2FProject%20Name.obj?v=1629227000106",
"skull.babylon"
);
boidLoad.onSuccess = function(task) {
//task.loadedMeshes[0].parent = null;
console.log(task.loadedMeshes);
task.loadedMeshes[1].position = new BABYLON.Vector3(0,5,0);
//task.loadedMeshes[0].scale(.1,.1,.1);
task.loadedMeshes[1]._scaling = new BABYLON.Vector3(.1,.1,.1);
//console.log(task.loadedMeshes[0]);
//console.log(task.loadedMeshes[1]);
stealthBoid = task.loadedMeshes[1].clone();
};
Cool. I’ve got it in there. I can even rotate it no problem.
But when I generate the clones and try to rotate them:
for (let i = 0; i < total; i++) {
//box for the boid body;
// const box = BABYLON.MeshBuilder.CreateBox("box" + i, {
// width: 0.3,
// height: 0.5,
// depth: 1.0
// });
const box = stealthBoid.clone();
box.rotation._y = 1.5708;
console.log(box);
box.boid = boidsManager.boids[i];
box.material = redMat; //pbr; //redMat; //brickMaterial; //red mat is the normal one
models.push(box);
}
For the life of me, I cannot. Essentially, I have cloned 10 stealth bombers and right now they are flying in the direction of their right wing, as opposed to flying from their center (like a real stealth bomber). I’m trying to rotate each clone 90 degrees, so they are flying correctly.
I correctly rotated the original model, which still didn’t do anything about the clones.
The clones have no parents, so how do I change their rotation so they fly right? The clones are operated using this library (Boids extension), but I don’t think I have to go mucking about in the library, i think I just have to change the orientation of the stealth bombers, right?
(I also try just rotation.y and nada).