# RotationGizmo: Can I get precise rotation value instead of Quaternion?

**URL:** <https://forum.babylonjs.com/t/rotationgizmo-can-i-get-precise-rotation-value-instead-of-quaternion/41708>\
**Category:** Questions\
**Tags:** gizmo, quaternion\
**Created:** [June 19, 2023, 2:31am UTC](https://forum.babylonjs.com/t/rotationgizmo-can-i-get-precise-rotation-value-instead-of-quaternion/41708 "2023-06-19T02:31:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChirodSummerset](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/chirodsummerset/32/31270_2.png) [@ChirodSummerset](https://forum.babylonjs.com/u/ChirodSummerset)\
**Post date:** [June 19, 2023, 2:31am UTC](https://forum.babylonjs.com/t/rotationgizmo-can-i-get-precise-rotation-value-instead-of-quaternion/41708/1 "2023-06-19T02:31:59Z")

</div>

Hi:

My scene uses a gizmo with 3 position gizmo and a rotation-y gizmo, the configure is like below:

```auto
    const gizmoMgr = new GizmoManager(scene);
    gizmoMgr.scaleGizmoEnabled = false;
    gizmoMgr.positionGizmoEnabled = true;
    gizmoMgr.rotationGizmoEnabled = true;
    gizmoMgr.usePointerToAttachGizmos = false;
    gizmoMgr.gizmos.rotationGizmo!.xGizmo.isEnabled = false;
    gizmoMgr.gizmos.rotationGizmo!.zGizmo.isEnabled = false;

```

When I use the rotation-y gizmo, the mesh in the scene works well, but the `rotationQuaternion.toEulerAngles()` always return a rotation-z(negative PI) and a rotation-y.

I know it is about the rotation order, but can I recaculate it as rotation-Y only? my database uses only rotation Y.

* * *

my code is like this:

```auto
        // the Load-and-Show phase
        // worldInfo is from db, the rotation contains string "0" as rotation.x and rotation.y
        const { position, rotation, scaling } = nodeInfo.worldInfo;
        const rotationArray = [rotation.x, rotation.y, rotation.z].map((v) => toRad(Number(v))) as [
            number,
            number,
            number,
        ];
        // and this is where the gizmo attached
        this.rootNode.rotationQuaternion = Quaternion.RotationAxis(Axis.Y, rotationArray[1]);

```

```auto
        // the Export phase
    this.rootNode.computeWorldMatrix(true);
        const { position } = this.rootNode;
        const quaternion = this.rootNode.rotationQuaternion!;
        quaternion.normalize();
        const quaternionRotation = quaternion.toEulerAngles();

        return {
            soulCode: this.nodeInfo.soulCode,
            worldInfo: {
                position: getStringCoord(position),
                rotation: getStringCoord(quaternionRotation, true), // parse an x,y,z like object to string and turn it into degree (the 2nd arg)

                scaling: getStringCoord(scaling),
            },
        };

```

---

<div class="post-metadata">

**Author:** ![mawa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mawa/32/12384_2.png) [@mawa](https://forum.babylonjs.com/u/mawa)\
**Post date:** [June 19, 2023, 8:58am UTC](https://forum.babylonjs.com/t/rotationgizmo-can-i-get-precise-rotation-value-instead-of-quaternion/41708/2 "2023-06-19T08:58:57Z")

</div>

I believe you can’t. You have to null the quartenion or set a new (Vector3 rotate), as per

> **[Rotation Quaternions | Babylon.js Documentation](https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/center_origin/rotation_quaternions#warning)**
>
> Learn about rotation quaternions in Babylon.js.

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [June 19, 2023, 12:38pm UTC](https://forum.babylonjs.com/t/rotationgizmo-can-i-get-precise-rotation-value-instead-of-quaternion/41708/3 "2023-06-19T12:38:26Z")

</div>

Hello,

Is the object you’re trying to rotate a GLB mesh? The z rotation might be related to the transformations to convert handedness. If so, you can use scene.useRightHandedSystem = true so the root node doesn’t have rotations anymore.

---

<div class="post-metadata">

**Author:** ![ChirodSummerset](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/chirodsummerset/32/31270_2.png) [@ChirodSummerset](https://forum.babylonjs.com/u/ChirodSummerset)\
**Post date:** [June 20, 2023, 1:13am UTC](https://forum.babylonjs.com/t/rotationgizmo-can-i-get-precise-rotation-value-instead-of-quaternion/41708/4 "2023-06-20T01:13:21Z")

</div>

Thank you, It is a glb mesh **root**. I later use AssetContainer.createRootMesh() to create a parent and attached the gizmo to parent, it works fine 🙂
