Merge branch 'scale-gizmo-fix' of https://github.com/Tryibion/FlaxEngine into Tryibion-scale-gizmo-fix
This commit is contained in:
@@ -269,7 +269,17 @@ namespace FlaxEditor.Gizmo
|
||||
_intersectPosition = ray.GetPoint(intersection);
|
||||
if (!_lastIntersectionPosition.IsZero)
|
||||
_tDelta = _intersectPosition - _lastIntersectionPosition;
|
||||
delta = new Vector3(0, _tDelta.Y, _tDelta.Z);
|
||||
if (isScaling)
|
||||
{
|
||||
var tDeltaAbs = Vector3.Abs(_tDelta);
|
||||
var maxDelta = Math.Max(tDeltaAbs.Y, tDeltaAbs.Z);
|
||||
var sign = Math.Sign(tDeltaAbs.Y > tDeltaAbs.Z ? _tDelta.Y : _tDelta.Z);
|
||||
delta = new Vector3(0, maxDelta * sign, maxDelta * sign);
|
||||
}
|
||||
else
|
||||
{
|
||||
delta = new Vector3(0, _tDelta.Y, _tDelta.Z);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -280,7 +290,17 @@ namespace FlaxEditor.Gizmo
|
||||
_intersectPosition = ray.GetPoint(intersection);
|
||||
if (!_lastIntersectionPosition.IsZero)
|
||||
_tDelta = _intersectPosition - _lastIntersectionPosition;
|
||||
delta = new Vector3(_tDelta.X, _tDelta.Y, 0);
|
||||
if (isScaling)
|
||||
{
|
||||
var tDeltaAbs = Vector3.Abs(_tDelta);
|
||||
var maxDelta = Math.Max(tDeltaAbs.X, tDeltaAbs.Y);
|
||||
var sign = Math.Sign(tDeltaAbs.X > tDeltaAbs.Y ? _tDelta.X : _tDelta.Y);
|
||||
delta = new Vector3(maxDelta * sign, maxDelta * sign, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
delta = new Vector3(_tDelta.X, _tDelta.Y, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -291,7 +311,17 @@ namespace FlaxEditor.Gizmo
|
||||
_intersectPosition = ray.GetPoint(intersection);
|
||||
if (!_lastIntersectionPosition.IsZero)
|
||||
_tDelta = _intersectPosition - _lastIntersectionPosition;
|
||||
delta = new Vector3(_tDelta.X, 0, _tDelta.Z);
|
||||
if (isScaling)
|
||||
{
|
||||
var tDeltaAbs = Vector3.Abs(_tDelta);
|
||||
var maxDelta = Math.Max(tDeltaAbs.X, tDeltaAbs.Z);
|
||||
var sign = Math.Sign(tDeltaAbs.X > tDeltaAbs.Z ? _tDelta.X : _tDelta.Z);
|
||||
delta = new Vector3(maxDelta * sign, 0, maxDelta * sign);
|
||||
}
|
||||
else
|
||||
{
|
||||
delta = new Vector3(_tDelta.X, 0, _tDelta.Z);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -305,7 +335,24 @@ namespace FlaxEditor.Gizmo
|
||||
if (!_lastIntersectionPosition.IsZero)
|
||||
_tDelta = _intersectPosition - _lastIntersectionPosition;
|
||||
}
|
||||
delta = _tDelta;
|
||||
if (isScaling)
|
||||
{
|
||||
var tDeltaAbs = Vector3.Abs(_tDelta);
|
||||
var maxDelta = Math.Max(tDeltaAbs.X, tDeltaAbs.Y);
|
||||
maxDelta = Math.Max(maxDelta, tDeltaAbs.Z);
|
||||
Real sign = 0;
|
||||
if (Mathf.NearEqual(maxDelta, tDeltaAbs.X))
|
||||
sign = Math.Sign(_tDelta.X);
|
||||
else if (Mathf.NearEqual(maxDelta, tDeltaAbs.Y))
|
||||
sign = Math.Sign(_tDelta.Y);
|
||||
else if (Mathf.NearEqual(maxDelta, tDeltaAbs.Z))
|
||||
sign = Math.Sign(_tDelta.Z);
|
||||
delta = new Vector3(maxDelta * sign);
|
||||
}
|
||||
else
|
||||
{
|
||||
delta = _tDelta;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user