Hey, I notice POV camera is driven by MouseX and MouseY axis, as defined in the input manager. This doesn’t seem to work out of the box for mobile (via Unity Remote anyway - I actually thought it would have).
Is there an best practise for making the POV camera respond to mobile input? Thanks!
Look at CinemachineTouchInputMapper
1 Like
Ok grabbed this script from elsewhere which implements a GetInputAxis delegate. It’s picking up input alright (through logging the values), but for some reason the result is a camera that just seems to shake (it seems to want to return to the centre, resulting in very erratic behaviour. Note I dont have centring of either axis enabled.
Cheers
using Cinemachine;
using UnityEngine;
public class CinemachineCoreGetInputTouchAxis : MonoBehaviour
{
public float TouchSensitivity_x = 10f;
public float TouchSensitivity_y = 10f;
// Use this for initialization
void Start()
{
CinemachineCore.GetInputAxis = HandleAxisInputDelegate;
}
float HandleAxisInputDelegate(string axisName)
{
switch (axisName)
{
case "Mouse X":
if (Input.touchCount > 0)
{
return Input.touches[0].deltaPosition.x / TouchSensitivity_x;
}
else
{
return Input.GetAxis(axisName);
}
case "Mouse Y":
if (Input.touchCount > 0)
{
return Input.touches[0].deltaPosition.y / TouchSensitivity_y;
}
else
{
return Input.GetAxis(axisName);
}
default:
Debug.LogError("Input <" + axisName + "> not recognyzed.", this);
break;
}
return 0f;
}
}
4219735–374788–ScreenRecording_02-15-2019 11-34-32.7z (1.91 MB)
I don’t understand why the camera is misbehaving. Must be some interaction with one of your other scripts.
I added a FreeLook vcam to an empty scene, attached your script, and it worked perfectly.