Resetting Camera Position
Here's the situation; when the player either dies or finishes the level the level will be reset (a bit harder if the player finished the level), which means the the camera needs to be reset to the starting position, which for reasons is 0, 3.95, -10 . Here's all the different ways I have tried to do this:
(within the CameraController class)
transform.position = new Vector3(0f, 3.95f, -10f);
nope,
Vector3 defaultPos = new Vector3(0,3.95f,-10f);
transform.position = defaultPos;
nope,
Vector3 defaultPos = new Vector3(0,3.95f,-10f);
transform.position = new Vector3(defaultPos.x, defaultPos.y, -10f);
(within the GameController class)
Camera mainCam;
mainCam = Camera.main;
mainCam.transform.position = new Vector3(0,3.95f,-10f);
nope
CameraController.Instance.transform.position = new Vector3(0,3.95f,-10f);
still nope
I'm honestly at the end of my rag here. I've been doing this fora bout 6 months now and I really thought I had gotten transforms and Vectors pretty well understood, but clearly not.
Any help will be greatly appreciated, Cheers
When you try to do it does it give you an error or what happens?
Answer by ata_2 · Jan 31, 2016 at 02:46 PM
test this this.gameobject.transform.position = new Vector3(0f, 3.95f, -10f); but make sure this code attached to camera