I’m having a bit of trouble getting the Cinemachine Virtual Camera to behave the way I’d like.
The game I am working on is a 2D platformer that allows the player to run along round planetoids that have their own gravity (vector aimed toward center of planetoids that pulls player in; player rotates accordingly so the feet or always pointing down). The issue I am having is with the Lookahead feature of Cinemachine.
While the player is “level” or orientated with local up as (0,1,0), the camera lookahead operates fine. I have the virtual camera set to ignore Lookhead in Y direction so when I jump is doesn’t Lookahead upwards (or down). However, when the player begins to walk around the planetoid and the player rotates according to the calculated gravity vector, the cinemachine lookahead starts to not work they way I would like. For instance, when the player is on the surface of a planetoid and is facing (world) down and the local up would technically be facing (1,0,0), it will then Lookahead when I jump (in the mostly x-direction) but not longer Lookahead along the plaer horizontal axis. Once the player is leveled off again, it works fine. Also, the camera rotates with the player perfectly fine.
I am using the 2D cinemachine virtual camera with the Follow and Target set to the Player. The Body field is set to Framing Transposer with some Lookahead Time and Lookahead Ignore Y = true.
What I am trying to accomplish is for the virtual camera to use the player’s local up (or Y-axis) when determining when to ignore Y Lookahead. I have tried adding the player Game Object for the World Up Override on the Cinemachine Brain hoping that would solve the issue. But that was not the solution. I’m thinkng there has to be a way to truly override the actual World Up to use the local Up, or to have the camera Lookahead ignore the Y that is local to the player instead of the world.
Any thoughts? Further questions? Thanks.