My Image Here : http://freeimagehosting.net/tdtv8
I am making a new function,(Silimar function to dota(warcraft) pin point on the map)now > i have scene that is split into half,left side is fix island map,where right side is for helicopter flying in the island,
Is there a way to make This>
i wanted to make it that when i mouse click on a location or an objects on the right side island map,its will display a pin point signal on the fix island map on the left side
So that we will be able to know wheres the location of the helicopter now.Can someone kindly help me with this Thx.
(For those who know dota(Warcraft))This function is similar it,like when we mouse click on the map,it will display a signal sign blinking on the mini map.
What I think you're wanting to do would take quite a bit of stuff if you did it the only way I can think that I'd do it at the moment.
Probably a better way than this, but if I did it right now I’d use a plane object set beneath the terrain and sized out bigger than the terrain with your 2Dtexture map used on its material ; a separate camera for the minimap with it’s layers and depth etc set and positioned to where all it showed was a top-down view of that plane ; then other gameObject(s) made for the map ‘blips’ that could be instantiated at the x/z of the raycast-hit’s of the mouse click (and above the plane on the Y-axis) and set to the minimap camera layer so it could only be viewed on the map and ignored in the rest of the game. …stuff like that. Don’t know, haven’t tried it, and haven’t searched for anything like it.
Be even easier if you used a 3D minimap (overhead camera) of gameplay area instead of a 2d texture image for it … basically the same, but less the extra plane and stuff.
Have you searched the forum?
Lo0Nuhtik's answer is interesting. My own first idea looked like this:
- Setup a plane with the map texture. TopView and match it with the 3d world under it.
- Find X,Z of all 4 plane corners. We now have an equivalent rectangle in 3d space.
- Delete the plane. Remember all 4 X,Z positions!
- Use GUI.DrawTexture() to draw the texture. Figure its 4 X,Y positions.
- Make a function that takes X,Y position and if within our texture rectange, returns percentage.
- Make a function that takes X,Y percentage position within our 3d space rectangle and return true values.
That was setting up, now for the actual "map blips":
- When user click over the texture rectangle, get the mouse position percentage within it.
- Convert that over to our 3d space rectangle.
- Raycast in 3d space using our new X,Z from far up, straight down. Read hit.point Y.
- We now have a close approximate of the 3d position relative to its texture.
- Instantiate bleep GameObject using our X,Y and the new Y from the ray hit.point + offset .
This is only a theoric step-by-step but it could give you another work angle idea. Basically our first step is setting up 'equivalent rectangles' to switch positions between 2d and 3d using relative positioning (percentages%).
OOPS: this actually 'set waypoints in the map, display them in world' and not 'display my position on the minimap'. The concept could still be used with little modification to work the other way, and requires no additionnal camera... but yeah, it might be farfetch, its just an idea.