When the player turns to the left, the texture of the weapon turns upside down. How can I solve this?
Shooting Script
public class Weapon : MonoBehaviour
{
[SerializeField] private float _offset;
[SerializeField] private GameObject _prefabBullet;
[SerializeField] private Transform _shootPoint;
[SerializeField] private PlayerMove _playerMove;
public void Shoot()
{
Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
float rotateZ = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(0f, 0f, rotateZ);
Instantiate(_prefabBullet, _shootPoint.position, _shootPoint.rotation);
}
}
Movement script (only method here)
private void Flip()
{
// Switch the way the player is labelled as facing.
m_FacingRight = !m_FacingRight;
// Multiply the player's x local scale by -1.
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
//transform.Rotate (0f, 180f, 0f);
}