Rotate a mesh and associated elements

I have a model that I am loading from a database and some associated markers getting displayed on its surface.
Now I’d like to change the models initial rotation within the scene and also of course the positions of the markers to stay at the correct spot.
However I am already not being able to achieve the first task.
I used

BABYLON.SceneLoader.ImportMesh("", "scenes/", "babylonJS_logo_v3.babylon", scene, function (meshes) {    
         cube = meshes[0]
         cube.rotation = new BABYLON.Vector3(1,0,1);

But that does not do anything.

What might be my error?


Note: Since meshes you import can have a rotationQuaternion set before applying a rotation set the rotationQuaternion to _null

From Importing Assets | Babylon.js Documentation

The cube is the 2nd object in the meshes array. Use cube = meshes[1] or cube = scene.getMeshByName("BJS-3D-logo_light.000").

1 Like

Great. Thanks.
So i got that wrong in the first place. Thought the loaded mesh would always be meshes[0].

So i was able to rotate the mesh accordingly.
However now I need to rotate the marker positions as well.
I tried to add the rotation_vector to them but that does not work as planned.
Would I need to mess with the quaternion?

One thing I noticed with your code is that you are trying to parent the markers to the cube, but because the mesh hasn’t loaded in yet when you create the sprites, they are actually not being parented. In order to fix this, you will want to create the markers after the mesh loads. Once they are parented, rotating the cube will move the markers around it correspondingly; is this what you’re looking for?

Here’s a modified PG: Parenting markers to cube | Babylon.js Playground (

1 Like

Well, I should have mentioned that I want the markers to always face the camera,
as they do in my example.
I think the parent code was transferred from an older version, sorry. I do not actually set it.
So what I am actually trying to achieve is, that the markers will always be attached to lets say the top left corner of the cube even if the cube’s rotation property has been changed.

I added a playground to illustrate what I mean:

I have played around but still cannot grasp how to do the transformation …
Where are the trigonometry gurus?