void Update() { peakMagnitudeTime += Time.deltaTime; if (peakMagnitudeTime > MAX_PEAK_MAGNITUDE_TIME) { ResetPhysicsPeaks(); } float triggerAxis = CrossInputManager.GetAxis(triggerName); if (triggerAxis > 0) { if (throwObject == null) { SpawnThrowObject(); isMaxTriggerAxisReached = false; ResetPhysicsPeaks(); } if (isMaxTriggerAxisReached == false) { UpdateThrowObjectScale(); } if (triggerAxis >= MAX_TRIGGER_AXIS) { isMaxTriggerAxisReached = true; } } else if (throwObject != null) { ReleaseThrowObject(); } }
private void UpdateThrowObjectScale() { float triggerAxis = CrossInputManager.GetAxis(triggerName); float triggerPercent = Mathf.Clamp01(triggerAxis / MAX_TRIGGER_AXIS); float scale = Mathf.SmoothStep(0.0f, 1.0f, triggerPercent) * throwObjectInitialScale; SetThrowObjectScale(scale); }
/// <summary> /// /// </summary> protected virtual void Update() { if (true) { m_HandStretch = HandJoint.N2A(1.0f - CrossInputManager.GetAxis(triggerName)); // Inverse the trigger value. for (int i = 0, imax = m_HandCtrl.fingers.Length; i < imax; ++i) { m_HandCtrl.fingers[i].Stretch(m_HandStretch); } } }