Forum rules - please read before posting.

Using AC's pathing methods (scripting).

Hi, I was just wondering what's the proper way to use AC's own pathing methods to generate new waypoints? Because I needed a waypoint system that allowed movement in the Y axis (flying), I actually created my own simple node waypoint system, which works nicely, but I'd like to use AC's own automatic path generation for path finding if possible. I was hoping someone could point me to the correct methods in AC I can use to do this.

Comments

  • To generate an array of Vector3 waypoints, call:

    myPointArray = KickStarter.navigationManager.navigationEngine.GetPointsArray (startPosition, endPosition, myCharacter);

    To move a character along this array, call:

    myCharacter.MoveAlongPoints (myList, false);  // False means don't run

    By default, a character's own Paths component will not allow them to walk in mid-air.  To change this, you will have to manually change their component's affectY value first, i.e.:

    myCharacter.GetComponent <Paths>().affectY = false;

    Alternatively, you could manipulate a separate Paths object by amending it's nodes List, and make the character move along it directly using the SetPath function.  This would allow you to avoid setting the character's own affectY variable, which would instead be taken from the Path currently being walked along.
  • Thanks I'll take a look :)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!