Пример #1
0
        private void OnInputDeviceMoved()
        {
            if (RTInputDevice.Get.Device.IsButtonPressed(InputDeviceDragButtonIndex))
            {
                if (_activeDragSession != null && _activeDragSession.IsActive)
                {
                    if (_activeDragSession.Update())
                    {
                        _dragInfo.TotalOffset    = _activeDragSession.TotalDragOffset;
                        _dragInfo.RelativeOffset = _activeDragSession.RelativeDragOffset;

                        _dragInfo.TotalRotation = _activeDragSession.TotalDragRotation;
                        _dragInfo.TotalScale    = _activeDragSession.TotalDragScale;

                        _dragInfo.RelativeRotation = _activeDragSession.RelativeDragRotation;
                        _dragInfo.RelativeScale    = _activeDragSession.RelativeDragScale;

                        float relativeDragOffset = _activeDragSession.TotalDragOffset.magnitude;
                        if (relativeDragOffset != 0.0f && OffsetDragAxisModify != null)
                        {
                            Vector3 relativeDragAxis = _activeDragSession.RelativeDragOffset.normalized;
                            relativeDragAxis = OffsetDragAxisModify(this, relativeDragAxis, _hoveredHandle.Id);

                            _dragInfo.RelativeOffset = relativeDragAxis * _activeDragSession.RelativeDragOffset.magnitude;
                            _dragInfo.TotalOffset    = _activeDragSession.TotalDragOffset - _activeDragSession.RelativeDragOffset + _dragInfo.RelativeOffset;
                        }

                        if (PreDragUpdate != null)
                        {
                            PreDragUpdate(this, _dragInfo.HandleId);
                        }

                        foreach (var behaviour in _behaviours)
                        {
                            if (behaviour.IsEnabled)
                            {
                                behaviour.OnGizmoDragUpdate(_dragInfo.HandleId);
                            }
                        }

                        if (PostDragUpdate != null)
                        {
                            PostDragUpdate(this, _dragInfo.HandleId);
                        }
                    }
                }
            }
        }
Пример #2
0
        private void OnInputDeviceMoved()
        {
            // TODO: Check how interactions with UI works
            if (EventSystem.current.IsPointerOverGameObject())
            {
                return;
            }

            if (RTInputDevice.Get.Device.IsButtonPressed(InputDeviceDragButtonIndex))
            {
                if (_activeDragSession != null && _activeDragSession.IsActive)
                {
                    if (_activeDragSession.Update())
                    {
                        _dragInfo.TotalOffset   = _activeDragSession.TotalDragOffset;
                        _dragInfo.TotalRotation = _activeDragSession.TotalDragRotation;
                        _dragInfo.TotalScale    = _activeDragSession.TotalDragScale;

                        _dragInfo.RelativeOffset   = _activeDragSession.RelativeDragOffset;
                        _dragInfo.RelativeRotation = _activeDragSession.RelativeDragRotation;
                        _dragInfo.RelativeScale    = _activeDragSession.RelativeDragScale;

                        if (PreDragUpdate != null)
                        {
                            PreDragUpdate(this, _dragInfo.HandleId);
                        }

                        foreach (var behaviour in _behaviours)
                        {
                            if (behaviour.IsEnabled)
                            {
                                behaviour.OnGizmoDragUpdate(_dragInfo.HandleId);
                            }
                        }

                        if (PostDragUpdate != null)
                        {
                            PostDragUpdate(this, _dragInfo.HandleId);
                        }
                    }
                }
            }
        }
Пример #3
0
        private void OnInputDeviceMoved()
        {
            if (RTInputDevice.Get.Device.IsButtonPressed(InputDeviceDragButtonIndex))
            {
                if (_activeDragSession != null && _activeDragSession.IsActive)
                {
                    if (_activeDragSession.Update())
                    {
                        _dragInfo.TotalOffset   = _activeDragSession.TotalDragOffset;
                        _dragInfo.TotalRotation = _activeDragSession.TotalDragRotation;
                        _dragInfo.TotalScale    = _activeDragSession.TotalDragScale;

                        _dragInfo.RelativeOffset   = _activeDragSession.RelativeDragOffset;
                        _dragInfo.RelativeRotation = _activeDragSession.RelativeDragRotation;
                        _dragInfo.RelativeScale    = _activeDragSession.RelativeDragScale;

                        if (PreDragUpdate != null)
                        {
                            PreDragUpdate(this, _dragInfo.HandleId);
                        }

                        foreach (IGizmoBehaviour behaviour in _behaviours)
                        {
                            if (behaviour.IsEnabled)
                            {
                                behaviour.OnGizmoDragUpdate(_dragInfo.HandleId);
                            }
                        }

                        if (PostDragUpdate != null)
                        {
                            PostDragUpdate(this, _dragInfo.HandleId);
                        }
                    }
                }
            }
        }