private void OnParentChanged()
        {
            if (_parent == null)
            {
                _localPosition3D = _position3D;
                _localRotation3D = _rotation3D;

                _localPosition2D        = _position2D;
                _localRotation2D        = _rotation2D;
                _localRotation2DDegrees = _rotation2DDegrees;
            }
            else
            {
                _localPosition3D = Quaternion.Inverse(_parent._rotation3D) * (_position3D - _parent._position3D);
                _localRotation3D = QuaternionEx.Normalize(Quaternion.Inverse(_parent._rotation3D) * _rotation3D);

                _localPosition2D        = Quaternion.Inverse(_parent._rotation2D) * (_position2D - _parent._position2D);
                _localRotation2D        = QuaternionEx.Normalize(Quaternion.Inverse(_parent._rotation2D) * _rotation2D);
                _localRotation2DDegrees = _localRotation2D.ConvertTo2DRotation();
            }

            UpdateChildTransforms3D();
            UpdateChildTransforms2D();
            OnChanged(new GizmoTransform.ChangeData(ChangeReason.ParentChange, GizmoDimension.None));
        }
        private void UpdateChildTransforms3D()
        {
            foreach (var child in _children)
            {
                child._position3D = _rotation3D * child._localPosition3D + _position3D;
                child._rotation3D = QuaternionEx.Normalize(_rotation3D * child._localRotation3D);
                child.Update3DAxes();

                child.UpdateChildTransforms3D();
                child.OnChanged(new GizmoTransform.ChangeData(ChangeReason.TRSChange, GizmoDimension.Dim3D));
            }
        }
        private void UpdateChildTransforms2D()
        {
            foreach (var child in _children)
            {
                Vector2 rotatedPos = _rotation2D * child._localPosition2D;
                child._position2D        = rotatedPos + _position2D;
                child._rotation2D        = (QuaternionEx.Normalize(_rotation2D * child._localRotation2D));
                child._rotation2DDegrees = child._rotation2D.ConvertTo2DRotation();
                child.Update2DAxes();

                child.UpdateChildTransforms2D();
                child.OnChanged(new GizmoTransform.ChangeData(ChangeReason.TRSChange, GizmoDimension.Dim2D));
            }
        }
        private void OnLocalRotation3DChanged()
        {
            if (_parent == null)
            {
                _rotation3D = _localRotation3D;
            }
            else
            {
                _rotation3D = QuaternionEx.Normalize(_parent._rotation3D * _localRotation3D);
            }

            Update3DAxes();
            UpdateChildTransforms3D();
            OnChanged(new GizmoTransform.ChangeData(ChangeReason.TRSChange, GizmoDimension.Dim3D));
        }
        private void OnLocalRotation2DChanged()
        {
            if (_parent == null)
            {
                _rotation2D = _localRotation2D;
            }
            else
            {
                _rotation2D = QuaternionEx.Normalize(_parent._rotation2D * _localRotation2D);
            }

            _rotation2DDegrees = _rotation2D.ConvertTo2DRotation();

            Update2DAxes();
            UpdateChildTransforms2D();
            OnChanged(new GizmoTransform.ChangeData(ChangeReason.TRSChange, GizmoDimension.Dim2D));
        }
 private void ChangeLocalRotation2D(Quaternion localRotation)
 {
     _localRotation2D = QuaternionEx.Normalize(localRotation);
     OnLocalRotation2DChanged();
 }
 private void ChangeLocalRotation2D(float localRotation)
 {
     _localRotation2DDegrees = localRotation;
     _localRotation2D        = QuaternionEx.Normalize(Quaternion.AngleAxis(_localRotation2DDegrees, Vector3.forward));
     OnLocalRotation2DChanged();
 }
 private void ChangeRotation2D(Quaternion rotation)
 {
     _rotation2D = QuaternionEx.Normalize(rotation);
     OnRotation2DChanged();
 }
 private void ChangeRotation2D(float rotation)
 {
     _rotation2DDegrees = rotation % 360.0f;
     _rotation2D        = QuaternionEx.Normalize(Quaternion.AngleAxis(_rotation2DDegrees, Vector3.forward));
     OnRotation2DChanged();
 }