Image as a map, clicking on it spawns Gameobject in the scene at that position.

I’d like to implement map with settable waypoints by clickin somewhere on the map and spawning GO at that location. Ideas appreciated.
I have compass it only needs a target to point to.
someone pointed out getting xy of image and converting it to xy of world but the map is not rectangle its teared paper so i guess no go ? : ) thanks J

Hello. I don’t know if there is any way faster o more simple, but this works, i did it a lot of times. Follow the logic…:

  • If you have 2 empty objects, with exactly same transform. Lets call them MapFrame1 and MapFrame2.

  • Then, each MapFrame have as a child the map itself, the real map (called Map1 and Map2), also with same transform properties.

  • Then you scale MapFrame1 to (0.1f ,0.1f, 0.1f)

  • If you perform a raycast in the Mapframe1, detect the hit, create a emtyobject (called for example PositionDetector) in that worldposition.

  • Then make this PositionDetector child of MapFrame1…

  • Create an EmptyObject (Called PositionFinder) as a child of MapFrame2.

  • And Finally:

    PositionFinder.transform.localPosition = PositionDetector.transform.localPosition

Both Objects (PositionFinder & PositionDetector) will be in same place relative to the map. So you can use this PositionFinder as a reference to spwan what you really want.

Bye ! :smiley: