Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: SeanC on March 16, 2014, 01:33:38 AM

Title: No "Corners" info in FSMNavMeshPath
Post by: SeanC on March 16, 2014, 01:33:38 AM
Hey all,

I was recently using the pathfinding actions to set up character movement which works great!

I next thought it would be cool to use the line renderer to draw a line along my navmesh path. To do this, all I need is to feed the corners of the FSMNavMeshPath to the line renderer. However, the "corners" section doesnt seem to populate, even when a valid path is stored.

(http://i.imgur.com/lCCzGQ9.jpg)

Upon further searching within the FSMNavMeshPath script, I see that it was left unfinished:

Quote
TODO: implement FsmNavMeshPath properly in NavMeshCalculatePath and NaMeshCalculatePathBetweenGameObject.
// this is currently very much under progress, not sure if this is the right way to go about this. maybe too advanced and should be left to user to implement this?

I think this information could be used for a lot of interesting things.
Would it be possible for someone to round this script off to include the ability to store (and access) the corners info for a path? Is this an inordinate amount of work? I'm no programmer so tell me if this is a lot.

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2014. All rights reserved.
//
// TODO: implement FsmNavMeshPath properly in NavMeshCalculatePath and NaMeshCalculatePathBetweenGameObject.
// this is currently very much under progress, not sure if this is the right way to go about this. maybe too advanced and should be left to user to implement this?

using UnityEngine;
using System.Collections;

public class FsmNavMeshPath : MonoBehaviour {
   
   //Corner points of path
   public Vector3[] corners;
   /*
   {
      get {
         if (path== null)
         {
          return null;
         }
         return path.corners;
      }
   }
   */
   
   public NavMeshPathStatus status
   {
      get
      {
         if (path== null)
         {
          return NavMeshPathStatus.PathInvalid;
         }   
      return path.status;
      }
   }

   public NavMeshPath path;
   
   // Use this for initialization
   void Start () {
     
   }
   
   void ClearCorners()
   {
      path.ClearCorners();
   }
   
   public string GetStatusString()
   {
      if (path ==null){
         return "n/a";
      }else{
         return path.status.ToString();
      }
   }
   
}
Title: Re: No "Corners" info in FSMNavMeshPath
Post by: jeanfabre on March 26, 2014, 01:01:36 AM
Hi,

 ok, the current beta version of PlayMaker features arrays, so this will become available as 1.8 is released.

https://trello.com/c/qDIf01zA/65-navmesh-path-corners-exposure

 Bye,

 Jean
Title: Re: No "Corners" info in FSMNavMeshPath
Post by: SeanC on April 07, 2014, 05:41:11 PM
Excellent! Ill check it out when 1.8 releases!

Thanks Jean!
SeanC
Title: Re: No "Corners" info in FSMNavMeshPath
Post by: devbysam on December 19, 2015, 12:07:24 AM
I installed 1.8 beta and updated FSMNavMeshPath.cs and I think the corners array is working

Code: [Select]
//Corner points of path
public Vector3[] corners;

void Update() {
  if (path != null) {
    corners = path.corners;
  }
}
Title: Re: No "Corners" info in FSMNavMeshPath
Post by: devbysam on December 19, 2015, 07:55:09 PM
I updated NavmeshCalculatePath to store the corners in whatever array is chosen.

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
Title: Re: No "Corners" info in FSMNavMeshPath
Post by: jeanfabre on December 21, 2015, 01:46:09 AM
Excellent!

 I have to make an update on all packages for U5.3 and P1.8 anyway, I'll integrate your work, thanks!

It's on trello: https://trello.com/c/iff1O9az/157-pathfinding-for-5-3-and-1-8b

 Bye,

 Jean
Title: Re: No "Corners" info in FSMNavMeshPath
Post by: rik on December 28, 2015, 09:26:42 AM
Hi
thanks for the action but for some reason i was not able to debug action when i try to debug it does not draw the markers
Title: Re: No "Corners" info in FSMNavMeshPath
Post by: gozda on March 02, 2016, 06:21:06 AM
True this action is working on u5.32 and playmaker 1,8f43, but there is an action what fire event when agent reach 1st corner or nav mesh agent change 1st corner?
Title: Re: No "Corners" info in FSMNavMeshPath
Post by: jeanfabre on July 21, 2017, 08:48:23 AM
Hi,

 ok, this is now implemented :) sorry for the delay! Please update from the Ecosystem.

 Bye,

 Jean