- Home /
Question by
AidanHorton · Oct 19, 2014 at 02:28 PM ·
gameminimap
MiniMap Icons
The Problem
I've had this problem for a while now, and I cant seem to find a way around it. I am making a minimap for my car game, and here it is:
The minimap itself is drawn with a seperate script, and the movement of the minimap and arrow icon itself are contained in this script, which is attatched to the minimap camera:
var target : Transform;
var arrow : Transform;
function Update () {
transform.position = Vector3(target.position.x, transform.position.y, target.position.z);
arrow.position = Vector3(target.position.x, transform.position.y - 50, target.position.z);
arrow.transform.localRotation.y = target.transform.localRotation.y;
//This is for limiting the position of the camera
//to stay on the terrain
if (transform.position.z > 1805) {
transform.position.z = 1805;
}
if (transform.position.z < 197) {
transform.position.z = 197;
}
if (transform.position.x > 1804) {
transform.position.x = 1804;
}
if (transform.position.x < 197) {
transform.position.x = 197;
}
}
So as I was saying, the problem with this is that when the car for example rotates over itself, the icon points in the wrong direction, then starts moving in the opposite direction. When the direction of the car and the direction of the arrow 'meet up' through sheer luck, the arrow follows the rotation of the car's y axis as usual.
Please help! Comment if you aren't sure on the problem!
minimapicon.jpg
(14.6 kB)
Comment