Hi,
I’m trying to set the position of a loaded mesh (exported from blender 2.8), but it stays at the same position 0,0,0. I use mesh.setAbsolutePoistion(otherVector3), but the mesh not update its position.
I’ve searched for a answer without sucess. I use the SceneLoader.ImportMeshAsync to load the meshes and I get one to be the player, and that don’t move.
Man, I don’t know how to setup the scene at the PG, but my code from set the player mesh, is just:
const view = document.getElementById("view") as HTMLCanvasElement;
const engine = new Engine(view, true);
const scene = new Scene(engine);
BABYLON.SceneLoader.ImportMeshAsync(null, "https://raw.githubusercontent.com/cpusam/cpusam.github.io/master/tux/", "TUX.rEMESHblend.babylon", scene)
.then((result) => {
let playerMesh = result.meshes.find(m => m.name === "playerTux");
//now add the mesh to player
//and finally, add the player.update() at the registerBeforeRender
//this update is where the player move, just a position.x += 0.05
//and before quit update, it do playerMesh.setAbsolutePosition(this.position);
});
hahaha ok man, I don’t have some time free, because it’s monday and I was working.
But, maybe at the saturday I will prepare to you a full minimal source to you help me.
So, just wait a little. And if you have some ideia, share here.
Even at work if you ask for help it’s often worth to spend time for it, you will be more efficient once answered
If you had read the doc’ above, you could have notice that you just had to change the mesh url from the playground example of using raw.githubusercontent.com part.
There is one way that this will happen that, while unlikely, will be very difficult to find. There is a freezeworldmatrix custom Blender property. If that was checked, it will not move, because you asked it not to.
The two most likely reasons are:
a spelling error on the function name, just like you did in the first post.
Your code for getting mesh is flawed. I use scene.getMeshById(). To rule out, run the dispose() method. If still there, then this is the problem.
I shouldn’t have to say it, but check the console too.