playMaker

Author Topic: No "Corners" info in FSMNavMeshPath  (Read 2589 times)

SeanC

  • Junior Playmaker
  • **
  • Posts: 60
    • View Profile
No "Corners" info in FSMNavMeshPath
« on: March 15, 2014, 10:33:38 PM »
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.



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();
      }
   }
   
}

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14692
  • Official Playmaker Support
    • View Profile
Re: No "Corners" info in FSMNavMeshPath
« Reply #1 on: March 25, 2014, 10:01:36 PM »
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
« Last Edit: March 25, 2014, 10:03:56 PM by jeanfabre »

SeanC

  • Junior Playmaker
  • **
  • Posts: 60
    • View Profile
Re: No "Corners" info in FSMNavMeshPath
« Reply #2 on: April 07, 2014, 02:41:11 PM »
Excellent! Ill check it out when 1.8 releases!

Thanks Jean!
SeanC

devbysam

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Re: No "Corners" info in FSMNavMeshPath
« Reply #3 on: December 18, 2015, 10:07:24 PM »
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;
  }
}

devbysam

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Re: No "Corners" info in FSMNavMeshPath
« Reply #4 on: December 19, 2015, 05: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

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14692
  • Official Playmaker Support
    • View Profile
Re: No "Corners" info in FSMNavMeshPath
« Reply #5 on: December 20, 2015, 11:46:09 PM »
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

rik

  • Full Member
  • ***
  • Posts: 247
    • View Profile
Re: No "Corners" info in FSMNavMeshPath
« Reply #6 on: December 28, 2015, 07: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

gozda

  • Junior Playmaker
  • **
  • Posts: 88
    • View Profile
Re: No "Corners" info in FSMNavMeshPath
« Reply #7 on: March 02, 2016, 04: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?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14692
  • Official Playmaker Support
    • View Profile
Re: No "Corners" info in FSMNavMeshPath
« Reply #8 on: July 21, 2017, 05:48:23 AM »
Hi,

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

 Bye,

 Jean