Cinemachine FreeLook - Change Xaxis.Value from 180 to -90 without it facing a reverse turn.

Hi, i try to create a camera for a cube character. I use FreeLook and contrain a position of camera on different angle.
When the Xaxis.Value is 180 (max value indicated) and i want change the position on -90, the camera passes first on 90, 0 and then -90 which makes a reverse turn to the camera to arrive at the requested position. I tried doubling or tripling the max and min values but the problem remains the same.

Please, help me to make it possible for the camera to go to the different positions without having to make a reverse turn (example: change position to the right indefinitely (posStart > pos1 > pos2 > pos3 > posStart > pos1 > etc…).

8736024--1182738--Axis value.JPG


8736024--1182744--script value.JPG
8736024–1182747–NewCamCube.cs (3.6 KB)

EDIT : i solved my problem. For someone have a same problem, this is a solution :
switch (currentPos)
{
case pos.start:
valuePos = pposStart;
break;
case pos.pos1:
valuePos = ppos1;
break;
case pos.pos2:
valuePos = ppos2;
break;
case pos.pos3:
valuePos = ppos3;
break;
}

if (freeLook.m_XAxis.Value > 160 && valuePos < pposStart)
{
freeLook.m_XAxis.Value -= 360;
}
else if (freeLook.m_XAxis.Value < -80 && valuePos > pposStart)
{
freeLook.m_XAxis.Value += 360;
}

freeLook.m_XAxis.Value = Mathf.Lerp(freeLook.m_XAxis.Value, valuePos, speedLerp * Time.deltaTime);

1 Like