Optimized Oribit Camera in Replay, now only moving with right click
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using Unity.Cinemachine;
|
||||
|
||||
public class OrbitCameraMouseControl : MonoBehaviour
|
||||
{
|
||||
[Header("Input Actions")]
|
||||
public InputActionReference aimAction; // CM Default / Aim
|
||||
|
||||
[Header("Cinemachine Components")]
|
||||
public CinemachineInputAxisController inputAxisController;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
if (aimAction != null)
|
||||
aimAction.action.Enable();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (aimAction != null)
|
||||
aimAction.action.Disable();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
bool isAiming = aimAction != null && aimAction.action.ReadValue<float>() > 0.5f;
|
||||
|
||||
if (inputAxisController != null)
|
||||
{
|
||||
inputAxisController.Controllers[0].Enabled = isAiming;
|
||||
inputAxisController.Controllers[1].Enabled = isAiming;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user