Reposition target and camera runtime - how to avoid the "popping"?

I’m in the making of a simple endless game where I use Cinemachine.
My problem is that - as endless games require - I occasionally revert the position of the player and the environment to avoid going to high float values.
I do have damping on my camera’s X which causes a noticeable “popping” in the otherwise seamless revert.
How could I avoid this popping?
Here’s what I code, pretty simple:

playerTransform.position -= delta;
Camera.main.transform.position -= delta;
1 Like

Oh boy, I don’t think we cover that case! Let me think more about it and get back to you.

1 Like

Can you show me a picture of your vcam inspector?

@Gregoryl Okay, thanks. Btw cinemachine solves a lot of scripting for a decent cam movement for a project so thanks for adding it in :slight_smile:

3368149--263975--upload_2018-1-25_16-31-31.png

Note I messed around with the cam a bit after the post so it isn’t exactly the same but the popping effects remains.
@Gregoryl Did I post the info you needed?

Yes, the popping effect will remain so long as you have damping. You can’t just poke the Unity Camera’s position, because it’s 100% controlled by the vcam, so your value will be immediately overwritten.

We need to add an API call in the vcam to apply the delta to both the camera and the damping data. There’s no other way to get it to work. I’ll see if I can throw together a patch for you. Is this your only vcam?

1 Like

Yep, only Vcam. How to make that API call? Edit: and only camera in the scene. Edit again, the “we” in “we need to apply…” refers to you at unity, or you and I? :smile: sorry, not a native speaker, got confused xd.

I need to give you a patch for CM that adds the API call. What version of CM are you using?

Latest I found on the asset store, 2.1.10

ok, thanks. Stay tuned, I’ll get something to you asap.

Great thanks :smile: in the meantime I build other parts of the game.

We’ve had similar issues where we needed to position and rotate the camera because of seamless portals connecting with other parts of the level. Have not been able to get it working if there is an active blend occuring during the teleportation or if recentering is enabled on the active vcam.

@Gregoryl Wouldn’t want to rush you but approximately when to expect a patch?

It’s a little tricky, and there are a few things to check. Also there are other fires around here :). Probably today or tomorrow.

That’s actually pretty quick. Keep up the good work :smile:

I have a fix for the repositioning of a camera, but rotation is a little trickier. Can you give a little more info about your situation? A sample project would be great.

PMing you with the patch

Sorry took apart some stuff in the project :frowning: Right now it doesn’t have the “teleport back” feature. However, It doesn’t rotate the camera, it’s fix always. It only tracks the movement of the player, the rotation of the cam is the same always.

Any updates on this? I’m in the same boat as agiro. I recenter the whole world regularly.