here is the link for the tutorial that i saw few days ago,http://www.jakel168.com/2010/09/how-to-make-mini-map-for-your-scene-in.html, its nice but seems not working on android platform.
this error is always popping out Assets/minmap.js(53,12):BCE0051: Operator ‘*’ cannot be used with a left hand side of type ‘float’ and a right hand side of type ‘Object’.
error at Assets/minimap.js at line: 48
pls
can anyone out there help me to make it work on android platform.
//just paste this code to the first/3rd person controller/you're character
//For placing the image of the mini map.
var miniMap : GUIStyle;
//Two transform variables, one for the player's and the enemy,
var player : Transform;
var enemy : Transform;
var enemy2 : Transform;
var enemy3 : Transform;
var enemy4 : Transform;
//Icon images for the player and enemy(s) on the map.
var playerIcon : GUIStyle;
var enemyIcon : GUIStyle;
var enemyIcon1 : GUIStyle;
var enemyIcon2 : GUIStyle;
var enemyIcon3 : GUIStyle;
//Offset variables (X and Y) - where you want to place your map on screen.
var mapOffSetX = 762;
var mapOffSetY = 510;
//The width and height of your map as it'll appear on screen,
var mapWidth = 200;
var mapHeight = 200;
//Resolution (both width and height) of your terrain.
var sceneWidth = 500;
var sceneHeight = 500;
//The size of your player and enemy's icon as it would appear on the map.
var iconSize = 10;
var iconHalfSize;
function Update () {
iconHalfSize = iconSize/2;
}
function GetMapPos(pos : float, mapSize, sceneSize) {
return pos * mapSize/sceneSize;
}
function OnGUI() {
//Everything about the map.
GUI.BeginGroup(Rect(mapOffSetX,mapOffSetY,mapWidth,mapHeight), miniMap);
var pX = GetMapPos(transform.position.x, mapWidth, sceneWidth);
var pZ = GetMapPos(transform.position.z, mapHeight, sceneHeight);
var playerMapX = pX - iconHalfSize;
var playerMapZ = ((pZ * -1) - iconHalfSize) + mapHeight;
GUI.Box(Rect(playerMapX, playerMapZ, iconSize, iconSize), "", playerIcon);
var sX = GetMapPos(enemy.transform.position.x, mapWidth, sceneWidth);
var sZ = GetMapPos(enemy.transform.position.z, mapHeight, sceneHeight);
var aX = GetMapPos(enemy2.transform.position.x, mapWidth, sceneWidth);
var aZ = GetMapPos(enemy2.transform.position.z, mapHeight, sceneHeight);
var bX = GetMapPos(enemy3.transform.position.x, mapWidth, sceneWidth);
var bZ = GetMapPos(enemy3.transform.position.z, mapHeight, sceneHeight);
var cX = GetMapPos(enemy4.transform.position.x, mapWidth, sceneWidth);
var cZ = GetMapPos(enemy4.transform.position.z, mapHeight, sceneHeight);
var enemyMapX = sX - iconHalfSize;
var enemyMapZ = ((sZ * -1) - iconHalfSize) + mapHeight;
var enemy2MapX = aX - iconHalfSize;
var enemy2MapZ = ((aZ * -1) - iconHalfSize) + mapHeight;
var enemy3MapX = bX - iconHalfSize;
var enemy3MapZ = ((bZ * -1) - iconHalfSize) + mapHeight;
var enemy4MapX = cX - iconHalfSize;
var enemy4MapZ = ((cZ * -1) - iconHalfSize) + mapHeight;
GUI.Box(Rect(enemyMapX, enemyMapZ, iconSize, iconSize), "", enemyIcon);
GUI.Box(Rect(enemy2MapX, enemy2MapZ, iconSize, iconSize), "", enemyIcon1);
GUI.Box(Rect(enemy3MapX, enemy3MapZ, iconSize, iconSize), "", enemyIcon2);
GUI.Box(Rect(enemy4MapX, enemy4MapZ, iconSize, iconSize), "", enemyIcon3);
}
GUI.EndGroup();