Quantcast
Channel: Answers for "Flipping a 2D sprite based on direction along the x axis (2D)?"
Viewing all articles
Browse latest Browse all 4

Answer by Haxxxxx

$
0
0
Turns out I needed to check it against velocity, answer below: // Use this for initialization void Start () { waypoints = GameObject.Find("Waypoints").transform; someScale = transform.localScale.x; } // Update is called once per frame void Update () { if (rigidbody2D.velocity.x >= 0) { transform.localScale = new Vector2(someScale, transform.localScale.y); } else { transform.localScale = new Vector2(-someScale, transform.localScale.y); } }

Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>