Free Look Camera retargeting Value Range

Hello,

I want the X-Axis Value Range to follow the forward transform of my character.
Meaning when the character rotates, the value range rotates with him.

So basically having a “local” x-axis value range parented to the player.

Is there maybe an easy way to do this?

EDIT:
After going into some complicated math I just figured out a very easy solution:

            var rotation = rotateObject.transform.rotation.eulerAngles;
           
            freeLookCamera.m_XAxis.m_MinValue = rotation.y - Mathf.Abs(xAxisDefaultValueRange.x);
            freeLookCamera.m_XAxis.m_MaxValue = rotation.y + Mathf.Abs(xAxisDefaultValueRange.y);
1 Like

Even easier: set the Binding Mode to LockToTargetWithWorldUp.

Sorry I should have been more precise. I want actually the camera to follow the player, but get the value range from another object :wink:
Maybe even there is an easier solution? Because I had to add some more code for not snapping at 0° and 360°.

There is no easier solution built into CM for this usecase. What you’re doing is probably the best way.

1 Like