Gizmo - the problem with the pivot

Hello everybody!
I just realized gizmo feature and decided to use it for my project. I have multiple objects that I imported using AssetsManager. 3D Models are in .obj extension and since they are complex models; they consist of a lot of meshes. To be able to manipulate the whole mesh, I assigned parent dummy mesh for each object and assigned transformation values to the child meshes. But when I rotate or move the parent mesh, it rotates around the parent node which is in the origin. How can I change the pivot to the center of the meshes? What I have so far; https://playground.babylonjs.com/#SEIT79#1

I would appreciate any help :slight_smile:
Thank you in advance!!!

I assume this is incomplete :smile:

1 Like

ahaha yes. i uploaded by mistake :smile: .Now it is complete.

hello @trevordev will be able to assist you but we need a repro in the playground

Here is a documentation about referencing external assets: Using External Assets - Babylon.js Documentation

1 Like

Thank you!! I created the playground :slight_smile:

1 Like

After taking a look, using MakeNotPickableAndWrapInBoundingBox should work. This will find the bounding box of a mesh, create a new invisible box mesh where the bounding box is and then parent the object to the bounding box mesh. Then, if the gizmo is attached to that everything hopefully will work as expected. See https://playground.babylonjs.com/#SEIT79#2

1 Like

Thank you so much for your help. It works perfectly with that method. Can I ask one last question? :slight_smile: When I am moving or rotating the picked mesh, I want to be able to see changing transformation values. I have been working on it but I can only see the position after I moved the object not during dragging. You can see: https://playground.babylonjs.com/#SEIT79#5

Try this https://playground.babylonjs.com/#SEIT79#6 it uses the drag events that are a bit hidden within the pos/rot gizmo’s x y and z axis. Hopefully that helps.

2 Likes

It helped a lot. Thank you so much!!!