protected override void ToolGUI(SceneView view, Vector3 handlePosition, bool isStatic)
{
TransformManipulator.BeginManipulationHandling(false);
EditorGUI.BeginChangeCheck();
// The AimConstraint changes the rotation of the active object as the object is moved around in the scene.
// This leads to very large "jumps" of the object,
// as the move tool assumes the handle rotation to not change while the object is dragged.
// Solution: when moving an object constrained with the AimConstraint, we ignore the rotation of the object.
Quaternion handleRotation = Tools.handleRotation;
var aimConstraintComponent = Selection.activeTransform.GetComponent <UnityEngine.Animations.AimConstraint>();
if (aimConstraintComponent != null && aimConstraintComponent.constraintActive)
{
handleRotation = TransformManipulator.mouseDownHandleRotation;
}
Vector3 pos2 = Handles.PositionHandle(handlePosition, handleRotation);
if (EditorGUI.EndChangeCheck() && !isStatic && TransformManipulator.HandleHasMoved(pos2))
{
ManipulationToolUtility.SetMinDragDifferenceForPos(handlePosition);
if (Tools.vertexDragging)
{
ManipulationToolUtility.DisableMinDragDifference();
}
TransformManipulator.SetPositionDelta(pos2, TransformManipulator.mouseDownHandlePosition);
}
TransformManipulator.EndManipulationHandling();
}