Minimap player dot


How to make the player as dot on your minimap?

Here is the code without dot:

    var target : Transform;
 var damping = 6.0;
 var smooth = true;
function LateUpdate () {
   if (target) {
     if (smooth)
       // Look at and dampen the rotation
       var rotation = Quaternion.LookRotation(target.position - transform.position);
       transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * damping);
       // Just lookat
     transform.position.y = target.position.y + 90;
     transform.position.x = target.position.x;
     transform.position.z = target.position.z;
function Start () {
   // Make the rigid body not change rotation
     if (rigidbody)
     rigidbody.freezeRotation = true;

I guess this script is attached to a camera, which renders the scene from above?

A simple solution might be to create a big dot-like object (like a sphere or better simpler) and attach it to your player (a little bit above maybe). Then set the layer and the culling mask for the minimap camera and the main camera accordingly, so that the “dot” is only rendered on the map.


Of course there are several possible solutions for this. But they depend on how you setup your minimap…

  • Is it a camera which is rendering the whole scene from above?
  • Is it an image of the level which is displayed centered around the player?

Last time I created a minimap, I used NGUI to show an image (editied screenshot of the scene from above) with little sprite icons (dots, arrows) for different items on the map.


Two ways I can think of:

  1. Use SphereCast (docs are pretty straight forward) to locate each player from the camera above and then place a gui element on that camera for each player


  1. Create an array of gameobjects (players or NPC’s etc) and have a script attached to the minimap camera, then simply wizz through it grab their positions and add Gui elements for the minimap to represent their position.

I’d imagine you don’t want everything appearing on the minimap all the time(ie you want radar type effects) so either of these would work well, i’m not sure on how expensive SphereCasting is in terms of processing power.

I’ve just re-read you question, sorry i’ve just woken up! If its JUST the player you want then attach a script to your minimap camera and in the Start() function store a reference to your players gameobject.

Then in update simply add a gui element(your dot) to the present position of the player!

If you need more clarification let me know and i’ll be happy to help!

Good Luck!


the above solution worked but but is there is another solution for this ???