Hello, in this game, the camera is attached to the player as its child, the camera angle is fixed, even when the player rotates, but the camera position keeps changing every time the player rotates, as you can see below, the camera angle is fixed to one single direction, but when ever parent changes its rotation, it affects the child position, i dont want want my parents, rotation to affect my child Camera’s position…
//Camera Rotation Script
void Awake () {
//pos = transform.localPosition;
rotation = transform.rotation;
}
void LateUpdate () {
transform.rotation = rotation;
//transform.localPosition = pos;
}
//Camera Position Script
void Update () {
if(this.transform.rotation.y == 0f)
this.transform.localPosition = new Vector3(0f,13f,-4.5f);
else if(this.transform.rotation.y == 180f)
this.transform.localPosition = new Vector3(0f,13f,4.5f);
else if(this.transform.rotation.y == 90f)
this.transform.localPosition = new Vector3(-4.5f,13f,0f);
else if(this.transform.rotation.y == 270f)
this.transform.localPosition = new Vector3(4.5f,13f,0f);
}