Hello everyone, I am currently working on trying to create a rotating camera with the new Input system with mouse drag that also tracks the player. I am not sure where to start and cannot find many resources using Cinemachine + new Input system + click and drag mouse input.
Things I’ve tried:
CinemachineVirtualCamera with the body set to Framing Transposer (for following the player) and the aim as POV. I have found that changing the values on the vertical and horizontal axis on the POV are the values I want to change, but am not sure how to set up the Input Asset. I have added a CinemachineInputProvider that is supposed to map the input axes.
I have also added some code to attempt to map the mouse position on click and drag to the vertical and horizontal axes on the virtual camera.
Hopefully someone can point me in the right direction ![]()
public void OnRightClickDrag(InputAction.CallbackContext context)
{
beganDrag = true;
if (context.started)
{
playerController.initialPoint = Mouse.current.position.ReadValue();
}
if (context.canceled)
{
beganDrag = false;
}
}
private void RotateCamera()
{
currentPoint = Mouse.current.position.ReadValue();
Vector2 pointDiff = initialPoint - currentPoint;
if (playerInput.beganDrag)
{
if (pointDiff.x < 0)
{
cinemachinePOV.m_HorizontalAxis.Value += 0.5f;
}
else if (pointDiff.x > 0)
{
cinemachinePOV.m_HorizontalAxis.Value -= 0.5f;
}
if (pointDiff.y < 0)
{
cinemachinePOV.m_VerticalAxis.Value += 0.05f;
}
else if (pointDiff.y > 0)
{
cinemachinePOV.m_VerticalAxis.Value -= 0.05f;
}
}
}