How to add pointer observable to all the meshes imported from a glb

Hello Everyone,

I have been stuck on this issue for a while now. Any help would be greatly appreciated.

So, I’m currently importing a glb model into my scene. The model can have multiple meshes with different scales. In my scene I want to be able to pick that model and move it around using Gizmos because of this I have used the BoundingBoxGizmo.MakeNotPickableAndWrapInBoundingBox option to wrap my meshes.

Now the issue is that when I use that option it changes the scale values of my model. It usually wouldn’t be a problem but I want to keep the original scale values.

To explain my use case, I want to give the user the ability to create a full scene with multiple 3d assets and be able to scale, rotate, and position them anywhere in the scene. After which, I want to view the same scene the user created in Unity. To do that I created a JSON that keeps a record of where everything is in a scene.

In Unity, I parse that JSON object and try to replicate the scene. I was able to get everything working and showing correctly other than the glb models uploaded by the user during the creation of the scene.

The position and rotation are shown correctly in Unity but their scale is always random.

I have created a sample playground to show that when wrapping a mesh in Bounding Box Gizmo its scale is changed.

Playground Link

Is my current approach in solving this issue correct or is there another way to do this?

I was just facing the same issue - Check out the last link in this thread:

The method there of using asset container to load the GLB and then duplicating an instance of it, and putting a bounding box around it - works for the scenario you mention. And being sure to set any animations to frame0 before applying the bounding box.

Oh and if you’re picking meshes within a loaded GLB, be sure to keep them parented to their original parent… don’t pop them out of that hierarchy.

Thank you for the quick reply. But my issue still exists if I don’t use a model with animation in it.

Playground of Loading model without Animation

Okay, to make things more clear let me add some screenshots.

Below images are with BoundingBoxGizmo.MakeNotPickableAndWrapInBoundingBox used.

Notice the scaling values of both the box and root meshes.

Now if I don’t use the BoundingBoxGizmo and keep the meshes as it is below are the scaling values.

Also, to mention the reason why I am using the wrapping my meshes into BoundingBoxGizmo is because I want to be able to pick up all the meshes at once in scene pointerobservable.

cc @Cedric regarding the bounding box gizmo issue.

Actually, this is expected. Bounding box is a unit box scaled to encompass the elements.

Hi Cedric, thank you for the reply.

Is it possible to do the same thing but keep the original scale of the object?

As I explained earlier, I’m only using it to wrap my glb asset into an object so I can pick it up using pointer events. If there is another way to pick the whole glb asset or maybe keep the original scale of the object that would be great.

No, a bounding box is always a unit box with a scale.
Why is it a problem for you?

Because I want to keep the original scale values of the object.

So, I want to give the user the ability to create a full scene by uploading different assets(glb model). The user can then scale, move and rotate each object in the scene. When the user is done I save the scene in a json. The json contains the asset(glb model) cdn location plus its position, scale, and rotation.

After which I want to use the same json to load the scene in a unity(3d engine) app. Currently, everything is working fine except for the 3d asset scale. I’m able to replicate the whole scene in unity, the rotation and position are perfectly fine but the scale of the 3d assets is not correct.

I hope I’m able to explain my issue.