I’m using a cinemachine virtual camera. Follow and LookAt are both set to my player transform. The body of the camera is set to Transposer, binding mode: worldspace, with 0 dampening on x, y, and z.
In my code I’m changing the follow offset when when the camera can’t see the player at the normal follow offset:
CinemachineVirtualCamera cineCam;
CinemachineTransposer cineTransposer;
Transform player;
void Start()
{
cineCam = this.GetComponent<CinemachineVirtualCamera>();
cineTransposer = cineCam.GetCinemachineComponent<CinemachineTransposer>();
player = GameObject.FindGameObjectWithTag(Tags.player).transform;
}
void Update()
{
//funciton to raycast toward player from normal camera offset pos and see if it's viewable
bool isNormalViewingPos = ViewingPosCheck(player.position + new Vector3(-15f, 40f, -15f));
//if can't see player at normal viewing angle - move to secondary viewing angle
if (!isNormalViewingPos)
{
cineTransposer.m_FollowOffset = new Vector3(-5f, 40f, -5f);
}
else
{
cineTransposer.m_FollowOffset = new Vector3(-15f, 40f, -15f);
}
}
The issue is that the transition to the new follow offset looks really jumpy and not smooth. It’s looks as if it tries to transition from a different position to the new position rather than smoothly going from where it is to where the new values are.