Anthony,
I want to save the initial camera position for reset on each level start.
I move the cam to the given position and the position vector seems correct directly after moving.
But short after this the camera position z value changes. I did not understand why. Now The camera position is not correct.
private void Awake()
{
InitialPosition = cameraPerspective.transform.localPosition;
InitialRotation = cameraPerspective.transform.localRotation;
}
private void MoveToInitial()
{
Debug.Log("move to initial");
Debug.Log("current position: " + cameraPerspective.transform.localPosition);
Debug.Log("initial position: " + InitialPosition);
cameraPerspective.MoveCameraToInstant(InitialPosition, InitialRotation);
Debug.Log("position after move: " + cameraPerspective.transform.localPosition);
}
Logs
move to initial
current position: (-4.49, 9.64, -8.34)
initial position: (-4.49, 9.64, -8.34)
position after move: (-4.49, 9.64, -8.34)
But the camera changes z-value to -7.49 instead -8.34 after that. How can I prevent this?
Thanks