public void Bake(NavMeshBuildDebugSettings debug)
        {
            var sources = CollectSources();

            // Use unscaled bounds - this differs in behaviour from e.g. collider components.
            // But is similar to reflection probe - and since navmesh data has no scaling support - it is the right choice here
            var sourcesBounds = new Bounds(m_Center, Abs(m_Size));

            if (m_CollectObjects == CollectObjects.All || m_CollectObjects == CollectObjects.Children)
            {
                sourcesBounds = CalculateWorldBounds(sources);
            }

            var data = NavMeshBuilder.BuildNavMeshData(GetBuildSettings(),
                                                       sources, sourcesBounds, transform.position, transform.rotation, debug);

            if (data != null)
            {
                data.name = gameObject.name;
                RemoveData();
                m_BakedNavMeshData = data;
                AddData();
            }
        }
예제 #2
0
 private static bool UpdateNavMeshDataListInternal(NavMeshData data, NavMeshBuildSettings buildSettings, object sources, Bounds localBounds, NavMeshBuildDebugSettings debug)
 {
     return(INTERNAL_CALL_UpdateNavMeshDataListInternal(data, ref buildSettings, sources, ref localBounds, ref debug));
 }
예제 #3
0
 private static bool UpdateNavMeshData(NavMeshData data, NavMeshBuildSettings buildSettings, List <NavMeshBuildSource> sources, Bounds localBounds, NavMeshBuildDebugSettings debug)
 {
     if (data == null)
     {
         throw new ArgumentNullException("data");
     }
     if (sources == null)
     {
         throw new ArgumentNullException("sources");
     }
     return(UpdateNavMeshDataListInternal(data, buildSettings, sources, localBounds, debug));
 }
예제 #4
0
        private static NavMeshData BuildNavMeshData(NavMeshBuildSettings buildSettings, List <NavMeshBuildSource> sources, Bounds localBounds, Vector3 position, Quaternion rotation, NavMeshBuildDebugSettings debug)
        {
            if (sources == null)
            {
                throw new ArgumentNullException("sources");
            }
            NavMeshData navMeshData = new NavMeshData(buildSettings.agentTypeID);

            navMeshData.position = position;
            navMeshData.rotation = rotation;
            UpdateNavMeshDataListInternal(navMeshData, buildSettings, sources, localBounds, debug);
            return(navMeshData);
        }
예제 #5
0
 private static extern AsyncOperation INTERNAL_CALL_UpdateNavMeshDataAsyncListInternal(NavMeshData data, ref NavMeshBuildSettings buildSettings, object sources, ref Bounds localBounds, ref NavMeshBuildDebugSettings debug);
예제 #6
0
 private static AsyncOperation UpdateNavMeshDataAsyncListInternal(NavMeshData data, NavMeshBuildSettings buildSettings, object sources, Bounds localBounds, NavMeshBuildDebugSettings debug)
 {
     return(NavMeshBuilder.INTERNAL_CALL_UpdateNavMeshDataAsyncListInternal(data, ref buildSettings, sources, ref localBounds, ref debug));
 }