Imagine a character going from left to right, and right to left, and sometimes jumping up and down.
I want the camera follow this guy, but only in the left and right, with a little lag, exaggerated by the fact the camera is looking at this hero, but I don’t want the camera to follow in the up and down, nor look up and down.
How to do this with Cinemachine?
Teleport, in this same space, sometimes happens, from left to right, and vice versa, at which point their should be no noticeable change in the camera relative to the hero.
Is this also possible?
Any and all suggestions and mirth/mockery greatly appreciated.
@Gregoryl Is there a way to do the above with a LookAt, and just a slight bit of slop in the way the Follow works, so there’s some slight perspective change as the hero moves too fast for the camera Follow?
I’ve got it working… except I can’t constrain the camera to a Y setting. The camera is transforming with the target’s Y movement. Other than that, it’s working well.
Any idea how I can lock the vCam’s y to a set “latitude”?
The big, disconcerting glitches, that are infrequent, is Cinemachine flipping the Z value of the camera for a couple of frames. Not me, I promise. I’m not touching the Z value.
This is beginning to exceed the imaginative capacity of my tiny cranium. Any chance that you can throw together a little package that demos this so I can have a look?
I’m assuming you’re working in a test scene… with minimal artwork.
If not, it would be a good idea to make that, with a simple shape for a player, and minimal or no scenery. Wire in the camera and player controls, and the teleport stuff, so that the camera behaves the same way and shows the issue.
Save the scene.
Now do this:
And in the resulting popup select all the stuff that needs to be included in the package: scene, scripts, and (if needed, textures, and other assets - try to have as little as is reasonable).
Then hit export, and send me the result, which I will import into an empty project (you can test that before sending it to me).
This will come in very handy, soon… I’m sure to make more problems for myself!
This one, I have managed to fix. I tried a bunch of stuff, two things worked best…
Moved the offset maintainer to different updates, FixedUpdate seems to work best. I thought lateUpdate would work better, but it doesn’t.
Best change: Turned Binding Mode to “Lock to Target, No Roll”. I completely forgot about this setting. This was the cause of the glitch. Now it can’t flip around to the reverse Z position relative to the target, and never glitches.
Is “look ahead” incompatible with Warping? It wigs out, pretty hard. Goes the wrong way for a bit, by a good amount, and then tries to come back after a bit. Can’t find a way to stop this wigging out.
@Deeeds I take this back - in fact they should play nicely. Are you using the teleport code that you posted above? I don’t trust it. OnTargetObjectWarped() expects a delta position in world space. Your code is doing some funny business with the positions… why doesn’t it just pass (destTransform.position - srcTransform.position) as a parameter?
Can you have a read through this, help me understand what @MelvMay is trying to say? It might also help explain why I’m doing the translation of the transform from its position in one portal to the other ie. the object is moving so fast that it’s somewhere well outside the portal, not at an edge, by the time the physics engine realises its exited the portal and needs to be teleported.
Rather than have the teleport push it back to a position inside the destination portal on teleport, I use that world position and transform it to origin portal coordinates, then use that in the destination portal coordinates to find the world space to teleport to.
Both portals are the same size, orientation and shape.
anyways… here’s the physics discussion where I’m trying to find out how much granularity I can get with the new manual simulation of physics… could you help translate from MelvMay English to my moron designer language?
You don’t need a fast framerate or anything. If the player is moving really fast and you don’t get the trigger until it’s well past the portal, it won’t make any difference, you’ll be warped to a point similarly past the destination portal.