Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Custom Waypoints on Map

Discussion in 'Scripting' started by Chiroptera, Apr 16, 2014.

  1. Chiroptera

    Chiroptera

    Joined:
    Apr 16, 2014
    Posts:
    4
    Hey,
    I am currently working on map creation and trying out some things and need some help with custom markers or waypoints. Like in SaintsRow or Mafia2 or GTA where you can mark a place where you want to go and the way will be highlighted on the map/minimap so you don't have to memorize the way.

    I know how to make a map. I know how to make a minimap that updates your position (although I'm quite basic with that. I just put the map-texture on a plane below my terrain, I have a camera for the map and a gui-texture on that camera for my player. then I parent the map-camera under my playerobject so that it has the same x and z position). But I'm kinda stuck with that "marking a random point on the map" thing. I would imagine that it is quite easy to do, but I just can't get a good starting point - or lets say I just can't think of a way to do it right now.

    I need to be like pushed in the right direction. How would you do this? (I just need a description or an idea how I could do this - not an entire script or anything.)
    If I would need to set up my map in a different way than what I'm doing now, then please tell me. Maybe there's a more efficient way or mine's too basic to work with or anything like that. I'm no pro but I know a bit about unity and scripting and am eager to learn more.

    thx
     
  2. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    Assuming your "ground" has colliders on it I would raycast the ground to get the waypoint and then use A* to calculate a path from the player's position to the waypoint. This would involve giving your world some kind of navigation graph.
     
  3. Chiroptera

    Chiroptera

    Joined:
    Apr 16, 2014
    Posts:
    4
    Thanks. That helped a lot. Hadn't heard about A* until now - with that pathfinding system it really is as easy as I thought. I still have to look into the scripting part of it though. But that was definitely that piece of info I needed to go on.