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.
@Topper sorry for the delay . 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?
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 ;.)).