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Ā 

CinemachineComponentBase.OnTargetObjectWarped(Transform, Vector3)

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);

Hello World.

Hi, I’m Tom.

I’m a professional web developer and hobbyist video game developer, based in Berlin, Germany. I’m a vegan with vegetarian cheat days. I ride my bycicle everywhere. I’m a dad. I care about ethics in about every corner of life, without being a dick about it.
I’m old enough to say my first computer was a Commodore 64.

So this is going to be my place on the web where I’ll write about my upcoming game Super Space Arcade, random thoughts about the state of the internet and the federated web and things that interest or bug me. I’ll try to keep it positive although I can already see it go downhill from here. But who doesn’t like a good rant from time to time, right?

I’ll also feature posts and videos by good people on the internet who inspire me in the hope they’ll inspire you too. The world is not an evil place and I think we just need to be reminded of the fact that almost everything keeps getting better everywhere, it’s just that we are addicted to bad news and our news organizations are always there to satisfy this desire. Did I mention you should stop watching mainstream news? Not want to patronize you, but stop watch the fucking news. There you go.

See you around and in the meantime, be excellent to each other.
If you want to follow me on Mastodon, you can do that here.