Rotate Imported Meshes instead of Basic Shapes

Hi guys,

Another issue i’m facing. I was finally able to load the STL meshes with your help, but now I’m trying to animate them, and I found it’s possible to animate basic shapes created with BABYLON.Mesh.CreateBox( but not the meshes I imported with BABYLON.SceneLoader.ImportMesh(.

Is there a way to move the loaded STL meshes as well as it happens with the pre-built meshes?

Any advice would be really very appreciated.

Thank you,
Edu

Well a repro in the PG would be easier but you should just be able to do exactly the same thing as your rotate(greenBox).

Just call rotate(scene.getMeshByName(“name”)) inside your success callback and it should work

I have found when animating an imported mesh you cannot increment the values like we would think.

So an observable doing

mesh.position.x += 0.1

Will not work but…

If you have a scoped variable of x and your observable does this…

x += 0.1
mesh.position.x = x;

It will move. The properties can be set but are always original when reading the value so you have to keep a copy of that variable elsewhere.