I am using the Unity Engine and coding in C#.
I have a sprite as a parent with a main camera as a child so that the main camera follows the sprite. However, when pressing 'A' and 'D' to move the camera 'flips 180 degrees' due to me using transform.eulerangles is there anyway that the camera can be excluded from this 'flip'?
void Movement () {
anim.SetFloat ("moveSpeed", Mathf.Abs (Input.GetAxisRaw ("Horizontal")));
if (Input.GetAxisRaw ("Horizontal") > 0) {
transform.Translate (Vector3.right * moveSpeed * Time.deltaTime);
transform.eulerAngles = new Vector2(0,0);
}
if (Input.GetAxisRaw ("Horizontal") < 0) {
transform.Translate (Vector3.right * moveSpeed * Time.deltaTime);
transform.eulerAngles = new Vector2(0,180);
}
}