Removed TopDown View without deadzone. Exchanged Deadzone with Lookahead. Added Zoom to TopDown View
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using Oculus.Interaction;
|
||||
using Unity.Cinemachine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class CinemachinePositionComposerController : MonoBehaviour
|
||||
{
|
||||
[Header("Input Actions")]
|
||||
public InputActionReference zoomAction;
|
||||
|
||||
public CinemachinePositionComposer positionComposer;
|
||||
|
||||
private bool zoomBlocked = false;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
if (zoomAction != null)
|
||||
zoomAction.action.Enable();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (zoomAction != null && !zoomBlocked)
|
||||
{
|
||||
Vector2 zoomValue = zoomAction.action.ReadValue<Vector2>();
|
||||
positionComposer.CameraDistance = positionComposer.CameraDistance - zoomValue.y * 0.25f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void SetBlocker(bool value)
|
||||
{
|
||||
zoomBlocked = value;
|
||||
}
|
||||
|
||||
public void SetLookahead(bool value)
|
||||
{
|
||||
positionComposer.Lookahead.Enabled = value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user