Quantcast
Channel: Latest Questions by Z0hann
Viewing all articles
Browse latest Browse all 40

Minimap rotating nodes

$
0
0
Hey there ! I'm working on a minimap system and I'm stuck at a point. My minimap is working fine, but I'd like to improve it by rotating the nodes, which are displayed on the map. Here's what I've done so far. using UnityEngine; using System.Collections; using System.Collections.Generic; public class MiniMap : MonoBehaviour { public Texture building, arrow; private Rect buildingRect; private GameObject[] objects; private GameObject player; // Use this for initialization void Start () { objects = GameObject.FindGameObjectsWithTag("Objects On Map"); player = GameObject.Find ("Player"); } void OnGUI () { foreach (var obj in objects) { if (Vector3.Distance(obj.transform.position, player.transform.position) < 100) { buildingRect = new Rect((100 + (obj.transform.position.z - player.transform.position.z )),300 + ( obj.transform.position.x - player.transform.position.x ) , 10,10); GUI.DrawTexture(buildingRect, building); } } GUI.DrawTexture(new Rect(100, 300, 10,10),arrow); } } For now I'm displaying all nodes from a for each cycle, and it's only for testing purposes. I was playing around with either adding or subtracting the eulerangles.y from the displayed nodes X and Z coordinates but hence I don't know that much about that part of math, I'm asking for your help. I think I'm on the right way to go, but would need a push to continue developing my system. Thanks in advance !

Viewing all articles
Browse latest Browse all 40

Trending Articles



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