Rotation Gizmo on meshes with parents

Hello all,
This question may be quite simple for the experts.
I am trying to use the gizmo on meshes that belong to a hierarchy. The meshes are to be positioned and rotated in local space. Since only some meshes are to be allowed for manipulation, the are made part of the attachableMeshes array.

While positiongizmo seems to work in this way, rotationgizmo seems to do something unexpected. Instead of rotating on its own axis, it seems to be doing something else.

Here is the playground example.
(woodplank needs to be moved / rotated on its own axis)

Any help will be appreciated.

Pinging the gizmo’s author: @trevordev

I don’t see any issues with your scene. By the way, nice reflection mapping and skybox. Can you specify the function that doesn’t appear to work?


I think I am able to repro on latest instead of stable and I think this is a bug, ill see if I can find a fix.

PR containing a fix: unparent attached mesh before rotation by TrevorDev · Pull Request #6226 · BabylonJS/Babylon.js · GitHub

Hi Galen,
The scene is not mine :grin:. Copied from another standard example from PG.

You can just press “e” to enable rotation and click the box to rotate. That should rotate it about some strange axis.

Thanks trevor. I had tested this with both stable and latest and the behaviour was similar.


OK, I understand a bit better now. It appears you’re working in Euler space and not in quaternion space. Just rotate in quaternions and you’ll avoid the limit of 180 degrees vs. -180 degrees. It’s a bit of math, but a skill which is always valuable.


Thanks Galen,
It was a tough one, but I have managed to move to quaternions a while ago. :slight_smile:

This specific issue was part of the built in gizmo itself.


I’ve actually ignored gizmos in my code, and simply parented every object I need to manipulate. If you discard Gizmos, does your scene work? Sometimes we need to take a step back. Not fun, but saves more time than looking for the tools that might work for the masses.


:slight_smile: The scene works perfectly. Very happy with babylonjs. I am using babylonjs for engineering applications and prefer to use built in functions as I am not really a developer. I had my own code for translation and rotation (Euler angles though), however moved to gizmos for the looks and consistent behaviour and ease of use.




I am using Babylonjs 3.3.0 and have the same issue. I saw that the solution is in a PR. How can I update my babylonjs without using version 4 (since this version is breaking many things)?

I could solve some of the problems when migrating from 3.3.0 to 4.0.3, but now I cannot see the gizmo, even though I am copying the code from here, and in there, it is working properly. Can someone help me?


It seems to be working when using CDN, but when using Webpack in React it doesn’t work!!

EDIT: Solved, just remove all babylonjs dependencies, and install it again using npm install --save babylonjs