简体   繁体   中英

Unity: Camera resets to zero position when activated in Timeline [VR/3D]

I just started using Unity for a class I'm taking this semester and I've been having trouble with creating a cutscene. I have two cameras that are activated at different times in Timeline and every time the second camera is activated, instead of staying in the position I set in the editor, it snaps to (0,0,0). I'm not sure what's causing this, but I've spent the last few hours searching the web for answers... I'm sorry if this is a very elementary or simple question!

I'm not sure if this is useful, but I also have a third camera that is attached to the Player. The Player doesn't move, it only rotates to watch the cutscene.

Since this question has not been answered, I'll give my two cents as exactly the same problem occurred lately in my project.

It is likely that you have a top level GameObject containing a Camera and Animator component and you control the transform properties of the GameObject via Animation. That means you change the transform matrix from within the GameObject.

One solution is to open the timeline window, click the three dots of the animator that controls the camera and select Track Offsets > Apply Scene Offsets instead of Apply Transform Offsets.

Screenshot showing menu to select correct offsets

The (in my opinion) far better solution is to wrap the whole scene into a single root GameObject that has an animator itself and manipulate the camera as a child GameObject.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM