private void Update() { _scaleAction.ObjectToScale = _collisionTrigger.CollidedTransform; if (_leftButtonDownTrigger.IsValid() && (_collisionTrigger.IsValid() || _canScaleRight)) { _canScaleLeft = true; } if (_rightButtonDownTrigger.IsValid() && (_collisionTrigger.IsValid() || _canScaleLeft)) { _canScaleRight = true; } if (_leftButtonUpTrigger.IsValid()) { _canScaleLeft = false; } if (_rightButtonUpTrigger.IsValid()) { _canScaleRight = false; } _scaleAction.Update(_canScaleLeft && _canScaleRight); }
private void Update() { _followObjectPositionAction.Follower = _world; _followTwoObjectPositionAction.Follower = _world; _followObjectRotationAction.Follower = _world; _rotateAction.ObjectToRotate = _world; _scaleAction.ObjectToScale = _world; Transform targetToFollow = _grabButtonTrigger.TrackedDeviceProvider.GetOutput().transform; _followObjectPositionAction.TargetToFollow = targetToFollow; _followObjectRotationAction.TargetToFollow = targetToFollow; Transform secondTargetToFollow = _rotateScaleAndMoveButtonTrigger.TrackedDeviceProvider.GetOutput().transform; _followTwoObjectPositionAction.FirstTargetToFollow = targetToFollow; _followTwoObjectPositionAction.SecondTargetToFollow = secondTargetToFollow; if (_grabButtonTrigger.IsValid()) { if (!_collisionTrigger.IsValid() && !_grabbing && !_grabButtonDown) { _grabbing = true; } _grabButtonDown = true; } else if (_grabButtonDown) { _grabButtonDown = false; _grabbing = false; } if (_2ControllerPosition) { if (!_doubleGrabbing && _grabbing && _rotateScaleAndMoveButtonTrigger.IsValid()) { _doubleGrabbing = true; } else if (!_rotateScaleAndMoveButtonTrigger.IsValid() && _doubleGrabbing) { _doubleGrabbing = false; } } if (_2ControllerScale) { if (!_scaling && _grabbing && _grabButtonTrigger.IsValid() && _rotateScaleAndMoveButtonTrigger.IsValid()) { _scaling = true; } else if ((!_rotateScaleAndMoveButtonTrigger.IsValid()) && _scaling) { _scaling = false; } if (_scaling) { _scaleAction.ScaleValueX = _distanceProvider.GetOutput(); _scaleAction.ScaleValueY = _distanceProvider.GetOutput(); _scaleAction.ScaleValueZ = _distanceProvider.GetOutput(); } _scaleAction.Update(_scaling); } if (_2ControllerRotate) { _followObjectRotationAction.FollowTargetRotation = 0; if (!_rotating && _grabbing && _grabButtonTrigger.IsValid() && _rotateScaleAndMoveButtonTrigger.IsValid()) { _rotating = true; _rotationAngleProvider.Init(); } else if ((!_rotateScaleAndMoveButtonTrigger.IsValid()) && _rotating) { _rotating = false; } if (_rotating) { _rotateAction.RotationValue = _rotationAngleProvider.GetOutput(); } _rotateAction.Update(_rotating); } _followObjectPositionAction.Update(_grabbing); _followObjectRotationAction.Update(_rotating || _grabbing); _followTwoObjectPositionAction.Update(_doubleGrabbing); }
private void Update() { Transform targetToFollow = _grabButtonTrigger.TrackedDeviceProvider.GetOutput().transform; _followObjectPositionAction.TargetToFollow = targetToFollow; _followObjectRotationAction.TargetToFollow = targetToFollow; if (_highlightGrabTarget && !_grabbing) { if (_collisionTrigger.IsValid()) { if (_collisionTrigger.CollidedTransform.GetComponent <CollisionInteractable>().ContainsTag(_highlightTag)) { _highlightAction.ObjectToHighlight = _collisionTrigger.CollidedTransform; _highlightAction.SetCurrentHighlightOutline(_baseHighlightSize); } } _highlightAction.Update(_collisionTrigger.IsValid()); } if (_grabButtonTrigger.IsValid()) { if (_collisionTrigger.IsValid() && !_grabbing && !(!_allowBufferedGrabbing && _buttonDown)) { _followObjectPositionAction.Follower = _collisionTrigger.CollidedTransform; _followObjectRotationAction.Follower = _collisionTrigger.CollidedTransform; _grabbing = true; if (_highlightGrabTarget && _collisionTrigger.CollidedTransform.GetComponent <CollisionInteractable>().ContainsTag(EInteractable.Highlight)) { _highlightAction.SetCurrentHighlightOutline(_grabHighlightSize); } } _buttonDown = true; } else if (_buttonDown) { _buttonDown = false; _grabbing = false; if (_highlightGrabTarget) { _highlightAction.SetCurrentHighlightOutline(_baseHighlightSize); } } if (_2ControllerScale) { if (!_scaling && _grabbing && _scaleButtonTrigger.IsValid()) { _scaling = true; _scaleAction.ObjectToScale = _collisionTrigger.CollidedTransform; } else if ((!_scaleButtonTrigger.IsValid() || !_grabbing) && _scaling) { _scaling = false; } if (_scaling) { _scaleAction.ScaleValueX = _distanceProvider.GetOutput(); _scaleAction.ScaleValueY = _distanceProvider.GetOutput(); _scaleAction.ScaleValueZ = _distanceProvider.GetOutput(); } _scaleAction.Update(_scaling); } _followObjectPositionAction.Update(_grabbing); _followObjectRotationAction.Update(_grabbing); }