Question on GizmoManager

Hi guys,

kept playing around with GizmoManager (a really cool thingy btw).

I need a special behaviour of GizmoManager as follows:

I´ve two meshes a and b where b is child of a.

When I move a, b is supposed to move accordingly.

When I move b, only b moves but not its parent a.

Reading the API I came across onAttachedToMeshObservable but I don´t know what to do with it to
fullfil my needs. Basically I don´t know how to get the “current mesh” from GizmoManager.

My idea is to check:

if a mesh is a child mesh --> dispose.child
if a mesh is a parent mesh --> add.child

by getting parent-child-relations out of meshes names for example.

In my case there´s only one parent-cild-relation (only one level).
Every child has one parent, every parent can have several children.

Scenario is a conveyor and its light sensors.

I need to able to move conveyor and its sensors as well as single sensors along a conveyor´s axis.

If there´s a more elegant way, please let me know.

I startet a small PG here: https://www.babylonjs-playground.com/#6U08E0#9

Any help appreciated.

Thanks guys, Topper

Pinging @trevordev

I just got the first part myself:

var clickedMesh = gizmoManager.gizmos.boundingBoxGizmo.attachedMesh.id;

https://www.babylonjs-playground.com/#6U08E0#17

Thx, Topper

@ trevordev

There´s a ingnoreChildren property but no ignoreParent property which is actually exactly what I need.

cheers, Topper

Little progress but the boundingBox behaviour is kinda weird for some reason:

https://www.babylonjs-playground.com/#6U08E0#28

Last fail for today:

https://www.babylonjs-playground.com/#6U08E0#31

https://www.babylonjs-playground.com/#6U08E0#32

Just so you know @trevordev is on holidays but he will soon be back :wink:

yeah I already figured. :joy::joy:

There´s not really a rush.

Thx, Topper

@Topper sorry for the delay :christmas_tree: . It looks like there is a bug related to attaching bounding box gizmo to a child. I’m working on a fix for this. Should have a PR out by tomorrow.

Note: The parent must have uniform scale (eg 1,1,1) as non-uniform parents can cause undesired effects when rotating/scaling. Is that okay for your scenario?

1 Like

@ trevordev

Hey man, good to cu.

Here a few pictures of my future app to make you better understand what I want to achieve:

conveyors_03

It´ll be something like a 3D Editor for arbitrary conveyor layouts to emulate real ones and the plc controlling their drives and sensors.

As you can see in the 2nd picture I only need to use “move in x” and “move in z” as well as “rotate in y”.

BTW, I had to look up the diff between uniform scale and non uniform scale.
So fine by me, since I don´t need scaling in my application.
Ok, I´m using the bounding box, but only to show the user which mesh is selected.

In the 3rd picture you can see what I actually need.
The conveyor is the parent mesh and its child mesh is the light sensor (yellow arrow).
When the user moves the conveyor, the light sensor is supposed to move accordingly.
When the user moves the light sensor (only inside the conveyor´s bounding box), the conveyor must not move.

(only inside the conveyor´s bounding box) --> I´m gonna take care of this, btw (no needed feature, though ;.)).

Thx in advance,
Topper

Thanks for the extra info, I think this PR will get this working as expected: https://github.com/BabylonJS/Babylon.js/pull/5689

after that is merged, this playground hopefully should behave as you described
https://playground.babylonjs.com/#0RFLMJ#4

This is exactly the behaviour I need !!! :sunglasses::sunglasses::sunglasses::sunglasses::sunglasses:

You´re awesome, TrevorDev.

Thanks a lot,
Topper