protected virtual void Awake() { if (Application.isPlaying) { InitRequiredComponents(); } setupSuccessful = DetectSetup(); if (Application.isPlaying) { cvr = RegisterValueRange(); HandleInteractables(); } }
protected virtual void Awake() { if (Application.isPlaying) { InitRequiredComponents(); if (interactWithoutGrab) { CreateTriggerVolume(); } } setupSuccessful = DetectSetup(); if (Application.isPlaying) { valueRange = RegisterValueRange(); HandleInteractables(); } }
protected virtual void CalculateValue() { ControlValueRange controlValueRange = RegisterValueRange(); float angle; Vector3 axis; Quaternion rotationDelta = transform.localRotation * Quaternion.Inverse(initialLocalRotation); rotationDelta.ToAngleAxis(out angle, out axis); float calculatedValue = Mathf.Round((controlValueRange.controlMin + Mathf.Clamp01(angle / maxAngle) * (controlValueRange.controlMax - controlValueRange.controlMin)) / stepSize) * stepSize; float flatValue = calculatedValue - controlValueRange.controlMin; float controlRange = controlValueRange.controlMax - controlValueRange.controlMin; springAngle = (flatValue / controlRange) * maxAngle; value = calculatedValue; }