Pushing Cinemachine Camera to Do a Hard Position Change With Ontargetobjectwarped
While switching my camera system on Super Space Arcade from a classic camera rig to Cinemachine, I stumbled over an issue where the virtual camera would change its position smoothly, even though I set the transform to a new value. In my case, I need a hard reset of the camera position for the linear track being reset, to not run into overflow errors.
The way this can be achieved with Cinemachine I dug up somewhere in the forums, is
The first parameter is the moving objects transform, the second is the transform offset. In my case, the code looks something like this
CinemachineVirtualCamera vcam = this.GetComponent<CinemachineVirtualCamera>(); vcam.OnTargetObjectWarped(playerTransform, new Vector3(0,0,-trackResetZ);