Search Unity

NavMeshBuilder.UpdateNavMeshData's Param:localBounds

Discussion in 'Navigation' started by wang37921, Feb 15, 2019.

  1. wang37921

    wang37921

    Joined:
    Aug 1, 2014
    Posts:
    102
    upload_2019-2-15_18-45-27.png

    while i input default(Bounds), no navmesh generated.
    calc all input's bounds, the navmesh will be generated.

    btw, could add NavMeshBuildSourceShape.Plane...

    Unity2018 3.0f2

    Code (CSharp):
    1. using System.Collections.Generic;
    2. using UnityEngine;
    3. using UnityEngine.AI;
    4.  
    5. public class NewBehaviourScript : MonoBehaviour
    6. {
    7.     // Start is called before the first frame update
    8.     void Start()
    9.     {
    10.         var sources = new List<NavMeshBuildSource>();
    11.         sources.Add(new NavMeshBuildSource()
    12.         {
    13.             shape = NavMeshBuildSourceShape.Box,
    14.             area = 0,
    15.             size = new Vector3(100, 1, 100),
    16.             transform = Matrix4x4.identity
    17.         });
    18.  
    19.         var bounds = new Bounds(Vector3.zero, new Vector3(100, 1, 100));
    20.         // var bounds = default(Bounds);
    21.  
    22.         var data = NavMeshBuilder.BuildNavMeshData(NavMesh.GetSettingsByID(0), sources, bounds, Vector3.zero, Quaternion.identity);
    23.  
    24.         NavMesh.AddNavMeshData(data);
    25.     }
    26.  
    27. }
    28.  
     
  2. haofan

    haofan

    Joined:
    Mar 1, 2019
    Posts:
    1
    The same question