Gizmo position change

Hello i have problem with rendering position of mesh
This code works when i grab mesh by axis. But if i take take mesh by mouse and move with mouse it doesnt call this methods… And any idea why axis arent in middle of mesh?

public moveMesh = (gizmoManager) => {
    gizmoManager.positionGizmoEnabled = true;
    gizmoManager.boundingBoxGizmoEnabled = true;
    gizmoManager.rotationGizmoEnabled = false;
    gizmoManager.scaleGizmoEnabled = false;
    gizmoManager.attachToMesh(this.mesh);

    gizmoManager.gizmos.positionGizmo.xGizmo.dragBehavior.onDragObservable.add(
      () => {
        this.getMeshPosition(this.mesh);
      }
    );

    gizmoManager.gizmos.positionGizmo.zGizmo.dragBehavior.onDragObservable.add(
      () => {
        this.getMeshPosition(this.mesh);
      }
    );
    gizmoManager.gizmos.positionGizmo.yGizmo.dragBehavior.onDragObservable.add(
      () => {
        this.getMeshPosition(this.mesh);
      }
    );
  };

image

Can you provide a repro we can have a look at ?

I havent pg or something … meshes are importing from database, its angular project so they are not spawned in the middle and axis are away

1 Like

Yes, axis are in 0,0,0. So i cant change position of axis? and i dont know why but doesnt work

izmoManager.boundingBoxDragBehavior.onDragStartObservable.add(() => {
    console.log("Drag started!");

This doesnt work too

gizmoManager.boundingBoxDragBehavior.onDragObservable.add(() => {
      console.log('Pozicia');
      this.getMeshPosition(this.mesh);
    });

I neeed axis in the middle of mesh. They all have own localy position to 0,0 if you know what i mean, sorry for my english. It is possible? Because when i drag with that axis it change position so it can change position on render - click on mesh no?

Hmmm… yes i see it works in pg

I dont know how :confused: Maybe you can try ask me something what you need to know. Imported meshes has own local position setted to 0 0 0. Bouth are 0 0 0 but on different places. The next problem is there are still 2 axis.
image


I am using abstractmesh

it probably is a mesh and you can cast it:

...
(mesh as Mesh).bakeCurrentTransformIntoVertices();

Yes cast worked but it randomly change possittion of mesh. I know its hard to help with this. But i am amater with babylon and i got this project so i dont know post you how it is imported.

I did your code after click on mesh, this is logged when i log const center …
image
And after click on second mesh i cant click on the first, etc… And when i move with scene, clicked meshes sometimes blink.

i ll try

It works just on 1. mesh, if i iterate all meshes i can click on them :smiley: … idk if you cant help me when you do not see project

Hello @MrPeter just checking in, are you still having issues?

Yes, but i left it be.