How to make untouchable zone when using cinemachine? Suppose I have a mobile game, and I do not want the zone where the buttons are located to move the camera.
using Cinemachine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GetInputAxisCinimachine : MonoBehaviour
{
public float horizontalAimingSpeed = 6f;
public float verticalAimingSpeed = 6f;
public float TouchSensitivityX = 10f;
public float TouchSensitivityY = 10f;
// Start is called before the first frame update
void Start()
{
CinemachineCore.GetInputAxis = HandleAxisInputDelegate;
}
float HandleAxisInputDelegate(string axisName)
{
float leftTochZone = Screen.width - Screen.width / 100 * 80;
float rightTochZone = Screen.width - leftTochZone;
if (Input.touchCount > 0)
{
if (axisName == "Mouse X")
{
if (Input.touches[0].position.x > leftTochZone && Input.touches[0].position.x < rightTochZone || Input.touches[0].position.y > Screen.height - Screen.height / 100 * 70)
{
Debug.Log("Mouse X");
return Input.touches[0].deltaPosition.x / TouchSensitivityX;
}
}
if (axisName == "Mouse Y")
{
if (Input.touches[0].position.x > leftTochZone && Input.touches[0].position.x < rightTochZone || Input.touches[0].position.y > Screen.height - Screen.height / 100 * 70)
{
Debug.Log("Mouse Y");
return Input.touches[0].deltaPosition.y / TouchSensitivityY;
}
}
}
//return Input.GetAxis(axisName);
return 0;
}
}