Path/Road Editor & Waypoint Navigation

Creating and Editing Paths and Roads & Waypoint Navigation

To add a new path or road on a scene, choose "Add Asset To Scene-> Scripting-> Paths-> NewPath" in the context menu of a scene. You also can add a new path, having dragged NewPath asset from Asset Explorer on a scene.

On a scene there can be some paths, but it is possible to edit only selected «current» path.

Further it is necessary to add path points on a path. It can be doing in three ways:

  1. Alt-Left-Click at scene.
  2. Select “Add to Path” in context menu of a scene.
  3. Right click on the Path in World Explorer and select > Add Path Point (at Camera Position)


These options will add a new path point (in sequence after any previously created or selected path point) to the currently selected Path

You can click on a Path in World Explorer to view its path points and later on continue editing it.

Properties of a path can be edited in Object Editor. For example, it is possible to enable visualization of not current paths. To enable visualization of all paths at scene it is possible by means of the button «Show/Hide Paths» on scene toolbar.

When a path is selected in World Explorer, you can set its "Road" property to true, which causes the Path spline to be shown at runtime/during gameplay, instead of just during path editing.  You can also configure Width and Material under its "Road Settings" property, and later on, will be able to customize the height of the road as well.

The path can be added not only on a scene, but also on another «parent» object. For this purpose change ParentObject property in Object Editor.


Below is shown what paths look like when being visualized or edited.


 

Scripting Path Following for Avatars

An avatar can be setup to follow a path by selecting the Avatar (in the scene, or a prefab) and going to the Navigator ability (shown as a property category, under Abilities), and then going to the Path property under that, then pressing the "..." button in Object Editor for the Path property and selecting the existing Path in the currently edited scene to use.  
You can specify the path following mode (Once, Looped, or PingPong) by selecting from drop-down for Navigate's Mode property.

You may also be able to switch the Path Selector dialog to show Asset Database and select a path there to use, if an instance of that Path asset, with the same name, is later added to the scene.  Selection of paths not currently in the scene is experimental, and may be avaialble in future versions if not currently.
Navigate is available for Avatars and actors with ObjectType set to Character, and can also be enabled by selecting Avatar (or AvatarBase) as the entity type via the Entity Type (or Entity Base) property shown in Object Editor (possibly under the Visual Object category, or another).

Waypoint navigation can also be wired up for conditional triggering for an Avatar, by hooking up the Navigate behavior to an Avatar's Trigger (scriptable event).  
This can be done by drag-dropping it from Asset Explorer onto an Avatar, or drag-dropping onto its Activated trigger - which is where behaviors are added by default when drag-dropped directly onto an object/entity, or by drag-droppig it (or adding via right click > Add Asset context menu) onto another Trigger, user-defined or standard, for conditional triggering (instead of automatically on startup like for the Activated trigger).  Also, this can be triggered through Behavior Tree Editor, an alternative to Trigger wireup for more advanced use, just as other behaviors and actions can be.

You can also use the Navigate command in Python scripts, or the Navigate extension method (after adding a using statement for the Visual3D.Scripting.API namespace) in C#, to trigger path following for an avatar via a script or code.

Example of use of Navigate command in Python scripts

  1. Create a path and name it path1.
  2. Create the character and name it PlayerCharacter.
  3. Add the trigger on a scene with event «Scene Load» and action “PythonAction”.
  4. Open for editing «PythonAction» in Script Editor.
We need the Navigate command to make our lizardman follow the path. The command looks like this:

Navigate("self", "path", "mode")

Note you can also find this when right clicking in the code view and selecting code snippets. 

Where "self" is the entity, "path" is the PathObject and "mode" is the mode.

There are three modes:

Think of three path nodes, 1, 2 and 3.
  • Once: 1,2,3
  • Looped: 1,2,3,1,2,3,1,2,3,1,2,3...
  • PingPong: 1,2,3,2,1,2,3,2,1,2,3...
For now in our «PythonAction» code view we will add:

Navigate("PlayerCharacter", "path1", "Looped")

This will make our avatar always follow the path. Enter "Run" mode and click the Execute button in the script editor. You can now see how your avatar follows the path. (Note: This only works either when clicking execute or since this is an execute event, when the scene is reloaded.)

If you have any questions or feedback do not hesitate to post it.