- Home /
How do I make a camera stay after rotate it with lerp?
Hello,
I'm having trouble setting the camera's position where I want it to be.
The player walks into a room and steps on a special spot. Stepping on the spot, causes the camera to pan to the right to face a door. A video plays and then the camera pans back to it's original location when the player steps on the special spot.
I don't want the camera to pan back. I want it to stay looking at the door so the player will continue to walk through the door next.
So right now we disable the camera and character controller. Pan the camera and play the video. Then we enable the camera and character controller.
The act of enabling the camera makes it revert back to the original position it was in before we disabled it.
After we re-enable the camera, I've tried to manually reset the camera position/rotation like this:
Camera pFpsCamera = SceneManager.GetFirstPersonCamera();
GameObject m_pTargetCameraPosition = new GameObject("SaveCamera");
pFpsCamera.transform.rotation=m_pTargetCameraPosition.transform.rotation;
pFpsCamera.transform.position=m_pTargetCameraPosition.transform.position;
That did not work so I then tried the lookat command like this:
psCamera.transform.LookAt(m_pTargetCameraPosition.transform);
Neither one seems to have any effect on the first person camera. I feel like I'm missing a basic concept here. Please tell me what I'm doing wrong.