Xenko

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • Manual
  • API
  • Release notes
    Show / Hide Table of Contents

    Navigation components

    Beginner Level designer Programmer

    Navigation components allow entities to use navigation meshes to find paths through the scene. Alternatively, if you enable dynamic navigation in Game Settings, entities can generate their own navigation meshes.

    Add a navigation component

    1. Select an entity you want to use navigation.

    2. In the property grid, click Add component and select Navigation.

      Add navigation component

      Game Studio adds a navigation component to the entity.

    3. Under the Navigation component properties, next to Navigation mesh, click Hand icon (Pick an asset up):

      Open asset picker

    4. In the asset picker, select the navigation mesh you want the entity to use and click OK.

      Choose navigation mesh

      Alternatively, if you want this entity to navigate dynamically by generating its own navigation mesh, leave the Navigation mesh field empty. For more information, see Dynamic navigation.

    5. Under Group, select the navigation group the entity should belong to. The entity uses the navigation properties you set in this group.

      Choose navigation group

    Use navigation components in scripts

    For example:

    void Move(Vector3 from, Vector3 to)
    {
        var navigationComponent = Entity.Get<NavigationComponent>();
        List<Vector3> path = new List<Vector3>();
        if(navigationComponent.TryFindPath(from, to, path))
        {
            // Follow the points in path
        }
        else
        {
            // A path couldn't be found using this navigation mesh
        }
    }
    

    For more information, see the NavigationComponent API documentation.

    See also

    • Navigation groups
    • Navigation meshes
    • Navigation bounding boxes
    • Dynamic navigation
    • Improve this Doc

    Back to top

    Copyright © 2016 Silicon Studio
    Generated by DocFX