I am working on a game where you can flip gravity and walk on the ceiling.
But I can’t figure out how to flip the camera upside down so the player’s view looks the same on the floor and the ceiling.
I am using Cinemachine Free Look
camera.
I am working on a game where you can flip gravity and walk on the ceiling.
But I can’t figure out how to flip the camera upside down so the player’s view looks the same on the floor and the ceiling.
I am using Cinemachine Free Look
camera.
Okay, I figured it out myself. I had to make m_State
field of CinemachineFreeLook
class public
and then implement this code:
void Update()
{
if(_isInvertedGravity && FreeLook.m_State.RawOrientation.eulerAngles.z != 180)
FreeLook.m_State.RawOrientation = Quaternion.Euler(FreeLook.m_State.RawOrientation.eulerAngles + new Vector3(0, 0, 180));
}
Hi,
I have got the same issue but Unity doesn’t allow me to edit the CinemachineFreeLook
script and make m_State
variable public because it is an imported package. I have searched in the internet for any other solutions but i haven’t found any.
By the way, I don’t know if it matters but I am using the version 2022.3.24. I could also change it to 2021.3.9 if needed.
Changing CM source is not the way to do this, and will make trouble for you when later you want to upgrade the package. Please see the FreeLookOnSphericalSurface sample scene for an example of how to make FreeLook handle variable "up" direction. The main ingredients are: - use LockToTarget binding mode - override the CM Brain's world up (see the CM Brain inspector).
– StrangThis is not a good solution. Changing CM source is not the way to do this, and will make trouble for you when later you want to upgrade the package. Please see the FreeLookOnSphericalSurface sample scene for an example of how to make FreeLook handle variable “up” direction. The main ingredients are:
© 2022 - 2025 — McMap. All rights reserved.
Hi, I have got the same issue but Unity doesn't allow me to edit the CinemachineFreeLook script and make m_State variable public because it is an imported package. I have searched in the internet for any other solutions but i haven't found any. Am I doing something wrong and is there any other way to do it? By the way, I don't know if it matters but I am using the version 2022.3.24. I could also change it to 2021.3.9 if needed.
– UnattendedThis is not a good solution. Changing CM source is not the way to do this, and will make trouble for you when later you want to upgrade the package. Please see the FreeLookOnSphericalSurface sample scene for an example of how to make FreeLook handle variable "up" direction. The main ingredients are: - use LockToTarget binding mode - override the CM Brain's world up (see the CM Brain inspector).
– Strang