public override void OnButtonDown(XRButtonDatum buttonDatum) { base.OnButtonDown(buttonDatum); if (HeldButtons.Count == 1) { OneButtonBegin(true); } else if (HeldButtons.Count == 2) { _manipulationTransform.position = AveragedPosition(); _manipulationTransform.LookAt(HeldButtons[1].RayHitChildedToController.origin, RayOnHitObjectUp()); _subManipulationTransform.position = InputTargetPosition.Value; _subManipulationTransform.rotation = AttachedRigidbody.transform.rotation; if (_attachToInteractorPosition) { _priorManipulateRotation = _manipulationTransform.rotation; } else { _priorManipulateRotation = _subManipulationTransform.rotation; } InputTargetRotation = _priorManipulateRotation; if (_attachToInteractorPosition) { InputTargetPosition = _manipulationTransform.position; } else { InputTargetPosition = _subManipulationTransform.position; } } }
public override void OnButtonUp(XRButtonDatum buttonDatum) { base.OnButtonUp(buttonDatum); if (HeldButtons.Count == 1) { OneButtonBegin(false); } if (HeldButtons.Count == 0) { InputTargetPosition = null; InputTargetRotation = null; } }