Quantcast
Viewing all articles
Browse latest Browse all 125

Scripted rotation is inverted- GUI HUD.

Hello, thank you for taking the time to have a look at my issue. So I am trying to create a HUD which surrounds my player and has a Ping which always points to the nearest object. I did have this working, however I must have changed... something because now the rotation seems like it is mirrored from the desired direction( see GIF below) ![alt text][1] [1]: /storage/temp/172426-issue-hud-pings.gif and the code that I am using is: using System.Collections; using System.Collections.Generic; using UnityEngine; public class RadarTest : MonoBehaviour { // The target marker. public Transform target; public GameObject ping; // Angular speed in radians per sec. public float speed = 1.0f; void Update() { Vector3 dir = (target.position - transform.position).normalized; float angle = Mathf.Atan2(dir.x, dir.y) * Mathf.Rad2Deg; Debug.Log(angle); ping.transform.eulerAngles = new Vector3(0, 0, angle); } } Thank you again.

Viewing all articles
Browse latest Browse all 125

Trending Articles



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