Gizmo use tmpParent but do not preserve scaling sign


Like this,we do not preserve the attachedMesh scale sign now.And we set the attachedMesh parent as this._anchorMesh by this._anchorMesh.addChild(value).Then we set the attachedMesh parent as originParent.But we do not set preserve scale sign.
By the way,this true is that i hack the source code to test.It is false default.

The problem is that if the attachedMesh with custom parent.We should process it in gizmo method with preserve scale sign.

But i don’t know why the attachedMesh originParent is the scene Nodes,and it’s result is correct.I will keep a more deeply look,i think that there are some special processes with Nodes.

Yes, there are some special code paths and processes depending on the context where you create the gizmo. I’ve fixed it for some. But I can still repro for others.

I have a question that the boundingBoxGizmo class method _attachedNodeChanged.It has a process that change the attachedMesh parent as _anchorMesh and restore the attachedMesh parent as originParent.We do not need to set the attachedMesh parent with preserveScalingSign true?

I think that we need to set originParent with PreserveScalingSign true when we set Gizmo.PreserveScaling is true.If the Gizmo.PreserveScaling is true and we need to promise that the process in gizmo will not change the attachedNode scale sign.

Is there something wrong with my understanding?I think that if we set Gizmo.PreserveScaling is true.We should promise that the process in gizmo will not change the attachedMesh scale sign.But if we do not
call value.setPaarent(originParent, Gizmo.PreserveScaling),it will change the attachedMesh scale sign if the attachedMesh with negative scaling.

PreserveScaling should be used all along the process, for any attachment.
I get it working in your PG case, with or without parent. But I still have an issue when mixing Inspector and PG gizmo.

I pull the latest master code,in boundingBoxGizmo.ts row 523.If we need to call value.setParent(originParent, Gizmo.PreserveScaling)?


And there are others.Like dragBehaviors.

Yes, I’m changing all the occurences

1 Like

:heart:Thanks bro!I was just about to submit a PR :smile:.But i’m worried that my understanding is not deep enough.

1 Like

I did more fixes in this PR:

Can you please check it works for you?

BoundingBox is correct now.
But positionGizmo mesh has some problems,PG:

Not, it’s not a bug.
Gizmo is attached to a node that has a negative scaling component. To preserve the orthogonal nature of the gizmo, it must be oriented that way.

My understanding is the gizmo mesh always oriented to positive scaling direction.
I test it on blender and other 3D editor.It always oriented to positive scaling direction.

I’ve added a check for this particular case:

1 Like

Thanks for your hard work!I will test it as soon as possible when PG lastest branch merge the PR.

1 Like

It works,thanks for your hard work!

1 Like

But i think that it is hardly to understand that when i rotate the mesh over Math.PI and the rotate degree becomes (angle - 180).
I test it in other 3D editor.Because the rotate angle has direction.Clockwise is positive or so on.So the rotation gizmo behavior should add or reduce in one rotate direction?

angles are in the range[-pi…+pi] but you can accumulate the delta that is accessible here:

1 Like