Hello there
I have built a top view camera using cinemachine.
I want the camera to look at the player from above. If you zoom in with the middle mouse button, the camera comes a bit lower behind the player. If you keep the right mouse button pressed, you can rotate the camera around the player.
This behavior can be done very well and very fine adjustable by cinemachine. For this I used a free look camera with binding on wolrd space and I wrote my own modifiers for the input axes.
void Start()
{
CinemachineCore.GetInputAxis = GetInputAxis;
}
private float GetInputAxis(string axisName)
{
if (axisName == "Mouse Y")
{
if (Input.GetMouseButton(2))
{
return Input.GetAxis("Mouse Y");
}
return 0f;
}
if(axisName == "Mouse X")
{
if (Input.GetMouseButton(1))
{
return Input.GetAxis("Mouse X");
}
return 0f;
}
return Input.GetAxis(axisName);
}
Everything works the way I want it to. Almost.
When the player moves, there is always a little panning like rotation of the camera. I made a short video (from second 00:10) so you can see what I mean. I could’t find a way to turn off this behavior. Can someone maybe help me with this?