protected virtual void CreateNavigation() { m_Navmesh = new Navmesh(); m_Navigator = new NavigationEngine(m_Navmesh); m_Explorer = new ExploreEngine.Nearest(m_Navmesh, m_Navigator); m_Explorer.Enabled = false; }
public TestBot(Navmesh navmesh, NavigationEngine navigator, ExplorationEngine explorer, Vec3 pos, float speed, float angular_speed, bool enableExplorer = true) { m_Navmesh = navmesh; m_Navmesh.Verbose = true; //m_Navigator = new NavigationEngine(navmesh); m_Navigator = navigator; m_Navigator.EnableThreatAvoidance = true; m_Navigator.AddObserver(this); m_Navigator.CurrentPos = pos; //m_Navigator.EnableThreatAvoidance = true; //m_Navigator.DefaultPrecision = 20; //m_Navigator.Precision = 20; //m_Navigator.PathNodesShiftDist = 20; //m_Navigator.EnableAntiStuck = false; //m_Navigator.DestinationGridsId = dest_grid_id != -1 ? new List<int>(new int[] { dest_grid_id }) : null; //if (waypoints != null) // m_Navigator.Waypoints = waypoints; //m_Explorer = new Nav.ExploreEngine.Nearest(m_Navmesh, m_Navigator); m_Explorer = explorer; if (enableExplorer) { m_Explorer.Enabled = true; } m_Speed = speed; m_AngularSpeed = angular_speed; SimulateStuck = false; Paused = false; m_GotoPosUpdateTimer.Start(); }
protected virtual void CreateNavigation() { m_Navmesh = new Nav.Navmesh(false); m_Navigator = new Nav.NavigationEngine(m_Navmesh); m_Navmesh.RegionsMoveCostMode = Nav.Navmesh.RegionsMode.Mult; m_Explorer = new Nav.ExploreEngine.Nearest(m_Navmesh, m_Navigator); m_Explorer.Enabled = false; }
public NavMeshViewer(string[] args, Navmesh navmesh = null, NavigationEngine navigator = null, ExplorationEngine explorer = null) { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; BackColor = Color.LightGray; m_Params = new Params(args); m_Navmesh = navmesh; m_Navigator = navigator; m_Explorer = explorer; CreateNavigation(); LoadDebugConfig(); if (m_Params.HasParam("load")) { m_Params.GetParam("load", out string file); LoadData(file); } if (m_Params.HasParam("start")) { m_Params.GetParam("start", out string str); m_Navigator.CurrentPos = new Vec3(str); } if (m_Params.HasParam("end")) { m_Params.GetParam("end", out string str); m_Navigator.Destination = new destination(new Vec3(str)); } if (m_Params.HasParam("load_waypoints")) { m_Params.GetParam("load_waypoints", out string file); LoadWaypoints(file); } if (m_Params.HasParam("deserialize")) { m_Params.GetParam("deserialize", out string file); m_Navmesh.Deserialize(file); m_Navigator.Deserialize(file); m_Explorer.Deserialize(file); Vec3 initial_pos = m_Navigator.CurrentPos; if (initial_pos.IsZero()) { initial_pos = m_Navmesh.GetCenter(); } m_RenderCenter.X = initial_pos.X; m_RenderCenter.Y = initial_pos.Y; } InitializeComponents(); }
protected override void CreateNavigation() { m_MemoryContext = CreateMemoryContext(); m_Navmesh = Nav.D3.Navmesh.Create(m_MemoryContext, true); m_Navigator = new Nav.NavigationEngine(m_Navmesh); m_Navmesh.RegionsMoveCostMode = Nav.Navmesh.RegionsMode.Mult; m_Explorer = new Nav.ExploreEngine.Nearest(m_Navmesh, m_Navigator); m_Explorer.Enabled = false; m_AutoClearOnLocationChange = true; }
public ExplorationEngine(Navmesh navmesh, NavigationEngine navigator, int explore_cell_size = 90) { ExploreCellSize = explore_cell_size; m_Navmesh = navmesh; m_Navmesh.AddObserver(this); m_Navigator = navigator; m_Navigator.AddObserver(this); m_Navigator.m_RoughtPathEstimator = m_Navigator.m_RoughtPathEstimator ?? this; // generate exploration data from already existing grid cells Reset(); UpdatesThread = new Thread(Updates); UpdatesThread.Name = "Explorator-UpdatesThread"; UpdatesThread.Start(); }
public ExplorationEngine(Navmesh navmesh, NavigationEngine navigator, int explore_cell_size = 90) { ExploreCellSize = explore_cell_size; MAX_AREA_TO_MARK_AS_SMALL = 2000; ExploreDestPrecision = 20; m_Navmesh = navmesh; m_Navmesh.AddObserver(this); m_Navigator = navigator; m_Navigator.AddObserver(this); // generate exploration data from already existing grid cells Reset(); UpdatesThread = new Thread(Updates); UpdatesThread.Name = "Explorator-UpdatesThread"; UpdatesThread.Start(); }
public Navmesh(ExplorationEngine explorator = null, bool verbose = false) { Log("[Nav] Creating navmesh..."); RegionsMoveCostMode = RegionsMode.Mult; RegionsEnabled = true; UpdatesThread = new Thread(Updates); UpdatesThread.Name = "Navmesh-UpdatesThread"; UpdatesThread.Start(); Navigator = new NavigationEngine(this); if (explorator != null) { explorator.AttachToNavmesh(this); Explorator = explorator; } Verbose = verbose; Log("[Nav] Navmesh created"); }