CineMachine Freelook - X axis breaks when WorldUpOverride is sideways, any way to fix?
I have a ball moving along the inside of vertical circular track (like a ferris wheel). The gravity is set by the center of the wheel's position minus the ball's position (always pressing the player out).
I have a control transform for the ball that is set by the gravity orientation, and this sets the world up override.
However, as soon as the ball gets around the 90* vertical. While the camera still orients itself correctly, and up and down movement of the mouse still correctly adjusts the Y axis, the X axis becomes broken, doing some combination of freezing, clamping to almost no control, adjusting the Y axis instead, and inverting the controls.
Is there any way to fix this? Maybe the X axis is world-orientated and I can change it to be locally oriented somewhere? Or maybe with a simple controller script (detecting whether the player is upside down/sideways... and doing something? The axis inverting is the only thing I can think to fix with this, though, as I don't know enough of how cinemachine's rig turning works)
If not, I'll be switching to a custom camera controller and a camera rig built around the ball that detects the ground with raycasts to keep itself oriented properly... The only reason I don't want to do that is because there's so much power and control already in CineMachine, it'd be a waste not to utilize it.
Also, I have a custom extension script for a mouse scroll zoom. It adjusts the radius of the free look rigs. Is there a better way to have a mouse scroll zoom in the freelook camera that I may have overlooked? It works well enough, I am just curious as it seems like something that should be there.
I'd appreciate anyone taking the time to help me, I really want to be able to use CineMachine for everything and not have to try to make my own freelook camera controller as good as it is (except for this issue).
This is sad because I have everything else working now, and I really need my camera working so I can start testing in earnest. So I'm now working on a temporary camera rig separate from Cinemachine until I can figure this out.
Hopefully somebody with some experience can pitch a moment of their time to help me figure this out.
I didn't mention in original post, the follow mode is a FreeLook: Simple Follow With WorldUp, and the WorldUpOverride is changed dynamically with script. I've tried the other sets (locked + variations), with different headings and all, but haven't figured out where the issue is yet.
Did you find a solution to this? I have a similar issue with an entity walking around a sphere.
Not with cinemachine, unfortunately. I created my own camera rig and script that accomplished the dynamic world up rotation with a camrig gameobject that follows the player and adjusts to my gravity accordingly.
The main thing you need to consider is that to create a Quaternion.LookRotation, you need up and forward directions. Up is obvious, but forward can be based on several different things. If it's a linear track, you know what forward is, otherwise you can calculate the forward by the most recent difference in the player's position, or using landmarks/gravity zones or some other solution. This is important to make sure the player's camera angle doesn't just jerk to a random direction as the gravity changes.
I'm still working on ways to improve it though, as I'm trying to get it to smoothly rotate as the player moves further along a bezier curve. It rotates fine, but not very smoothly. I plan to add a leading object and lerp/slerp towards the lead object.
And then whenever I have a cinematic camera effect, the script just flicks on the Cinemachine Brain and it does it's thing, then disables itself when its done.
Not the cleanest, but it works for what I'm doing right now.
Your answer
Follow this Question
Related Questions
Run script when camera has turned x amount degrees 2 Answers
My player doesn't rotate at the same time with the camera. 0 Answers
Help With Camera rotation on X and Y Axis (Target Focused) 1 Answer
viewing on the Mouse Y axis not working. 0 Answers
Using DampSmooth in EulerAngle is affecting the Position.Z value of the gameObject. 0 Answers