Snap to start position

I have a setup where the player is spawned into the scene at a somewhat random position. As I start the scene, I want the camera to snap to where it will come to rest.

Right now it starts targeting wherever I’ve placed it in the scene, and then zooms over. If I turn on look ahead, the camera shoots off into space, apparently it believes that the player’s moved very far in a single frame, and applies look ahead interpolation to that movement?

The only thing I can find is OnTargetObjectWarped, which takes a delta position. That’s not very useful here - to get that to be right, I’d have to calculate where the player would have to be for the camera’s current position to be correct, and then calculate the delta position. But I don’t know what that is.
I could also set the position manually, but that’d have to be updated every time i change the vcam settings.

Is there no “snap to end” thing anywhere I can call?

Try vcam.PreviousStateIsValid = false. That will turn off the damping for this frame and make the vcam snap to the new target spot.

1 Like

Hi!

Thanks for the reply! That doesn’t seem to do anything for me, but I found a solution that did work in this instance: Turn standby update to Never. I guess the camera was getting round robbin calls while I was waiting for the player to load? Before the player loads, I have zero vCams enabled.

It would still be useful to have a good way to just snap the camera to the end. I could do that by having a different vcam with the exact same setup, and then cut to it, but that seems… hacky?

Let me see if I understand this.

  • While waiting for the player to spawn, you have no vcams enabled.

  • Where is the camera? How is it positioned?

  • Now, the player spawns, at some location P.

  • You enable a vcam, with a transposer that positions the vcam relative to P.

  • I believe that in that case, the vcam will snap to the appropriate spot relative to P. Standby Update should make no difference.

  • What exactly is the behaviour you are getting?

What version of Unity/CM are you using?

I just made a video to explain things, just under 4 minutes.

Available here.

Please let me know if there’s anything else I can tell you about this.

That’s really weird.

If the vcam is disabled then it’s not in standby, so will never be standby-updated until it’s enabled and even then only if there is some other vcam that’s active.
Are you sure you don’t have some other vcam that gets activated somewhere, even for a single frame?

One thing I noticed: your PreviousStateIsValid=false was on the wrong vcam.

The lookahead thing might be a bug. Would you be willing to export a simplified version of your scene that illustrates this problem and PM it to me?

D’oh.

I’ll get you a repro, no problem.

Sorry, it was my bad. I wasn’t initializing the follow object to the correct position, so the vCam was doing the correct thing.

1 Like