I have developed a runner game in unity, i have completed the coding part, but when i applied the animation to my character object(which is rotation in z-axis) the camera also rotates with it. So, how can i stop this rotation of main camera which is child of my main runner object. Also i don't want any change in rotation of Main Camera
Main Camera Transform:-
- The Initial Position is(3,13,-28).
- The Initial Rotation is(20,0,0).
- The Initial Scale is (0,0,0).
Some of the code i have tried in a separate script an attached it to main camera:-
- transform.parent = null;
- Camera.main.transform.rotation = Quaternion.identity;
- Camera.main.transform.eulerAngles = new Vector3(20,0f,0f);
- distanceTraveled1 = new Vector3(runnercode.distanceTraveled,0f,0f);
- Camera.main.transform.eulerAngles = new Vector3 (runnercode.distanceTraveled, 0f, 0f);(works,but rotation is always changes)
Any solution? i use C# scripting