When using the bounds control with scale configuration set to non uniform the object can have erratically and move in unintuitive ways.
I was able to reproduce this behaviour using the boundscontrols found in the MRTK sample scene just by setting the scale mode to non uniform.
The object should be moveable on a single axis related to the handle selected.
The object sometimes seems to move along a completely different axis and moves at inconsistent speeds making it impossible to use.
_(Links to sample github project preferred)_
2019.4.6f1
2.5
This should have already been fixed in #8923. Please try out the dev branch and let us know if you are still experiencing the problem.
I will test this when I have the opportunity, but looking through the PR I am not sure it will fix the issue. I have found this issue while FlattenAxis is set to 'Do Not Flatten'. It looks like it's related to rotation in some way. Parenting the object under a rotated parent causes the erratic behaviour.
Will report back after testing latest changes though to be sure.
Tried with dev branch this morning and the problem is still there.
I was able to reproduce with Unity 2019.4.15f1 and HoloLens 2 remoting.
After some work today we have come up with something that looks like a solution. Within BoundsControl.TransformTarget(HandleType transformType) we made the following changes:
Vector3 initialDist = (initialGrabPoint - oppositeCorner);
Vector3 currentDist = (currentGrabPoint - oppositeCorner);
becomes
Vector3 initialDist = Target.transform.InverseTransformVector(initialGrabPoint - oppositeCorner);
Vector3 currentDist = Target.transform.InverseTransformVector(currentGrabPoint - oppositeCorner);
and
var originalRelativePosition = initialPositionOnGrabStart - oppositeCorner;
var newPosition = originalRelativePosition.Div(initialScaleOnGrabStart).Mul(Target.transform.localScale) + oppositeCorner;
becomes
Vector3 originalRelativePosition = Target.transform.InverseTransformDirection(initialPositionOnGrabStart - oppositeCorner);
var newPosition = Target.transform.TransformDirection(originalRelativePosition.Mul(scaleFactor)) + oppositeCorner;
Thanks for sharing that with us! I'll take a look as soon as possible and in the meantime please feel free to open a PR for the change.
Most helpful comment
I will test this when I have the opportunity, but looking through the PR I am not sure it will fix the issue. I have found this issue while FlattenAxis is set to 'Do Not Flatten'. It looks like it's related to rotation in some way. Parenting the object under a rotated parent causes the erratic behaviour.
Will report back after testing latest changes though to be sure.