Attaching Gizmo to TransformNode. Instead attaches gizmo to root mesh

Hello,

I am trying to add gizmo to TransformNode. But I couldnt do it despite I tried many things.
When I click on Node, pickresult is correct but gizmo always added to root mesh and position is always same even pickresult changes.

Please help mee!

    let gizmoManager = new BABYLON.GizmoManager(scene);

    gizmoManager.positionGizmoEnabled = true;
    gizmoManager.rotationGizmoEnabled = true;
    gizmoManager.usePointerToAttachGizmos = true;



    scene.onPointerDown = function addGizmoOnMeshClick() {
        gizmoManager.attachableNodes = scene.transformNodes;

        const pickResult = scene.pick(scene.pointerX, scene.pointerY);
        console.log(scene.meshes);

        if (pickResult.hit) {
            console.log(pickResult.pickedMesh.parent);

            gizmoManager.attachToNode(pickResult.pickedMesh.parent);
            console.log(gizmoManager);
        } else {
            gizmoManager.attachToMesh(null);
        }

    }

I realized it is also not working with attachToMesh. Why it is attaching to root? :frowning:

Can you provide a repro in the playground ?

It seems to work here https://playground.babylonjs.com/#31M2AP#299

@sebavan Thank you for your response. I created a playground. Link below:

It is still not working

Shortly, I converted this model from STEP to GLB. And I am trying to attach gizmo only to every part of assembly. And I guess they are transformnodes of scene.

I don’t know why but when I used Gizmo instead of GizmoManager it worked.

1 Like

I suspect the GizmoManager’s own picking and attaching behavior was competing with yours… Because usePointerToAttachGizmos should be set to false since you’re doing that part yourself. Not sure if that was the only issue you were having with GizmoManager but prob part of it. :slight_smile: