3

I am working on a third person parkour game with new input system and cinemachine(Freelook). You move with the right joystick and look around using right joystick(Cinemachine Input provider). For doing tricks I am using button with one modifier, you press R2 and move the right joystick in different directions for different tricks. But when I move the right joystick for a trick cinemachine rotates the camera.

Is a way to stop cinemachine from rotating the camera when other buttons are pressed.

Thank you in advance, Hemanth

3 Answers3

0

You can simply disable the component.

public CinemachineFreeLook freeLook;

private void Lock() => freeLook.enabled = false;

Another way is to set the Mouse Axis Speed to zero. In this method, with the help of a tweener, you can gently disable the movement of the mouse.

private void Lock()
{
    DOVirtual.Float(freeLook.m_XAxis.m_MaxSpeed, 0f, 1f, value => freeLook.m_XAxis.m_MaxSpeed = value);
    DOVirtual.Float(freeLook.m_YAxis.m_MaxSpeed, 0f, 1f, value => freeLook.m_YAxis.m_MaxSpeed = value);
}
KiynL
  • 4,097
  • 2
  • 16
  • 34
0
freeLook.m_YAxis.m_MaxSpeed = 0;
freeLook.m_XAxis.m_MaxSpeed = 0;

You can just set the values to 0

DCKOCGI
  • 1
  • 1
-1

you can probably remove the component that will probably help

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 28 '22 at 15:50