CinemachineFreeLook How do I accurately set the X axis Angle of the main camera

I want to know how to accurately calculate the Angle of camera X Axis according to the value of Y Axis

It is a complex algorithm with dependencies on the FreeLook rig settings. There is no simple way to reverse-engineer this. What is the effect you’re trying to achieve? Maybe there is a simple alternative.

I want to enter X and Y values in the input box to rotate the camera to the specified Angle. Now the Y axis rotation of the main camera is the same as that of the virtual camera. I don’t know how to get the X axis value. I don’t know if I’m making myself clear. Thank you.
7802712--986202--upload_2022-1-12_23-58-45.jpg
7802712--986205--upload_2022-1-13_0-3-8.jpg

Is this something you want to do in the Editor as part of authoring a scene, or is it something you expect to be able to do at runtime?

I want to use it at run time, either to view objects freely or from a fixed Angle.

It would be nice to have a little more context. Do you really need to use the FreeLook, for example? Would a spherical orbit suffice (instead of the FreeLook’s complex 3-rig structure)? If you’re just setting up spherical orbits, then you can move away from the FreeLook and choosing angles would be easier.

You can try calling FreeLook.ForceCameraPosition(pos, rot). You give it the desired camera position and rotation. The camera will be placed there, and the X and Y axes get automatically set to the values that will bring the camera as close as possible to the desired pos/rot (the camera is constrained to its orbit settings). The camera will be initially positioned at the input pos/rot, then it will move to the nearest point on its orbit, either slowly or quickly, depending on the damping settings.

Yes, I only use a few of these features, and I’m trying to find another solution instead of using FreeLook.

I tried this method, and since I set Follow and Look At, it only changed the position and rotation of the FreeLook, but the view Angle of the main camera did not change.

Instead of FreeLook, you can use a normal vcam with Body = FramingTransposer and Aim=POV. Then the X and Y axes of the POV will correspond nicely with the camera rotation.

Yes, this is a good method, I can set the camera’s X and Y axis rotation very well, thank you.

1 Like