protected virtual void Update() { inputManager.Update(key); // Calculate delta if (requires == null || requires.gameObject.activeInHierarchy == true || Input.GetMouseButton(1) == true) { if (Application.isPlaying == true) { var delta = inputManager.GetAverageDeltaScaled(); pitch -= delta.y * pitchSensitivity; yaw += delta.x * yawSensitivity; } } pitch = Mathf.Clamp(pitch, pitchMin, pitchMax); // Smoothly dampen values var factor = P3dHelper.DampenFactor(dampening, Time.deltaTime); currentPitch = Mathf.Lerp(currentPitch, pitch, factor); currentYaw = Mathf.Lerp(currentYaw, yaw, factor); // Apply new rotation transform.localRotation = Quaternion.Euler(currentPitch, currentYaw, 0.0f); }
protected virtual void Update() { inputManager.Update(key); // Calculate delta if (CanRotate == true && Application.isPlaying == true) { var delta = inputManager.GetAverageDeltaScaled(true); pitch -= delta.y * pitchSensitivity; yaw += delta.x * yawSensitivity; } pitch = Mathf.Clamp(pitch, pitchMin, pitchMax); // Smoothly dampen values var factor = P3dHelper.DampenFactor(dampening, Time.deltaTime); currentPitch = Mathf.Lerp(currentPitch, pitch, factor); currentYaw = Mathf.Lerp(currentYaw, yaw, factor); // Apply new rotation transform.localRotation = Quaternion.Euler(currentPitch, currentYaw, 0.0f); }