Quantcast
Channel: Questions in topic: "gun"
Viewing all articles
Browse latest Browse all 592

Problem in 2D Gun Rotation

$
0
0
Hello everyone ![![alt text][1]][1] [1]: /storage/temp/14042-errrrrrr.png as u can see in picture when i aim in the right side my Gun is Okey but when i look/aim at the left side my Weapon Flipped Vertical Used Code : private var mousePos : Vector2; private var screenPos : Vector3; function Update () { mousePos = Input.mousePosition; screenPos = Camera.main.ScreenToWorldPoint(Vector3(mousePos.x, mousePos.y, transform.position.z - Camera.main.transform.position.z)); transform.rotation.eulerAngles.z = Mathf.Atan2((screenPos.y - transform.position.y), (screenPos.x - transform.position.x))*Mathf.Rad2Deg; }

Viewing all articles
Browse latest Browse all 592

Trending Articles



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