playMaker

Author Topic: Make the corners of a Navmesh Path visible?[SOLVED]  (Read 4025 times)

polygon

  • Playmaker Newbie
  • *
  • Posts: 18
Make the corners of a Navmesh Path visible?[SOLVED]
« on: January 22, 2015, 11:14:15 AM »
Hi,

I'm wondering how to make the Path of a Navmesh visible in the game view. My thought was to get all the waypoints (or "corners") that the path is made of and make them visible with a line render (line from a ->b ->c -> destination)

Unfortunately I didn't find any way to read the corners of a path in Playmaker but there's an option for this in the scripting reference of Unity:

http://docs.unity3d.com/ScriptReference/NavMeshPath-corners.html

So is there a custom action that does this?

Best regards,
Daniel
« Last Edit: December 21, 2015, 01:46:44 AM by jeanfabre »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Make the corners of a Navmesh Path visible?
« Reply #1 on: January 22, 2015, 11:27:46 AM »
There is an unknown number of corners that changes per path so we couldn't store them in individual predefined variables. It requires an array to store the corners so thats probably the reason this wasn't exposed as an action, there are a lot of use cases for this and it would be hard to cover without having a proxy to handle the array for whatever you are doing with the data.

For instance if we draw a line for you between the corners which is the easiest thing to do inside the action code to keep the array out of your hair.. The next request will be for control options for the line, and so on from there. Not really an effective solution. If we just output an Array of the points you can do whatever you want with that information and your own line implementation. But there is not an FsmArray variable in 1.7...

In 1.8 there are native arrays, so this would be something we could create an action for to have native support after its released, otherwise you would require ArrayMaker and a custom action to get the corners from the path for ArrayMaker.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

polygon

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Make the corners of a Navmesh Path visible?
« Reply #2 on: January 23, 2015, 03:47:18 AM »
Thank you, Lane!

I think it would be really useful to have such an Action in 1.8 that stores the corners in an array. I've seen many requests in the unity forums that deal with the same issue and displaying the Navmesh path is handy in many different situations - either relevant for the finished game or just for debugging purposes.

I'd really like to see this action in 1.8 and I hope you will implement it :)

Best regards,
Daniel

devbysam

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Make the corners of a Navmesh Path visible?
« Reply #3 on: December 19, 2015, 07:55:56 PM »
I updated NavmeshCalculatePath to store the corners in whatever array is chosen in the 1.8 beta.

Here's an example web player
http://playmakernavmesh.devbysam.com

Green dot is where you click
Blue dot is the closest point on the navmesh
Red dots are the corners

You can download the project here
http://playmakernavmesh.devbysam.com/project.zip