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 Navmesh(); m_Navigator = new NavigationEngine(m_Navmesh); m_Explorer = new ExploreEngine.Nearest(m_Navmesh, m_Navigator); m_Explorer.Enabled = false; }
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 NavigationEngine(Navmesh navmesh) { m_Navmesh = navmesh; m_Navmesh.AddObserver(this); UpdatesThread = new Thread(Updates); UpdatesThread.Name = "Navigator-UpdatesThread"; UpdatesThread.Start(); }
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(); }
public static void Render(Nav.Navmesh navmesh, Nav.ExploreCell cell, List <Nav.ExploreCell> all_cells, PointF trans, PaintEventArgs e, bool draw_id) { foreach (ExploreCell other_cell in all_cells) { if (cell.Id == other_cell.Id) { continue; } DrawLine(e.Graphics, Pens.Gray, trans, cell.Position, other_cell.Position); //DrawString(e.Graphics, Brushes.Black, trans, (cell.Position + other_cell.Position) * 0.5f, Math.Round(navmesh.Explorator.ExploreDistance(cell, other_cell)).ToString(), 8); } }
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 NavigationEngine(Navmesh navmesh) { m_Navmesh = navmesh; UpdatesThread = new Thread(Updates); UpdatesThread.Name = "Navigator-UpdatesThread"; UpdatesThread.Start(); Precision = 8; GridCellPrecision = 40; ExploreCellPrecision = 25; PathRandomCoeff = 0; PathNodesShiftDist = 5; CurrentPosDiffRecalcThreshold = 20; UpdatePathInterval = -1; EnableAntiStuck = false; IsStandingOnPurpose = true; MovementFlags = MovementFlag.Walk; }
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 TestBot(Nav.Navmesh navmesh, NavigationEngine navigator, ExplorationEngine explorer, Vec3 pos, Vec3 dest, bool explore = false, bool simulate_stuck = false, int dest_grid_id = -1, List <Vec3> waypoints = null) { m_Navmesh = navmesh; //m_Navigator = new NavigationEngine(navmesh); //m_Navigator.AddObserver(this); m_Navigator = navigator; m_Navigator.CurrentPos = pos; m_Navigator.Precision = 2; m_Navigator.EnableAntiStuck = true; 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; m_Explorer.Enabled = explore; Destination = dest; SimulateStuck = simulate_stuck; Paused = false; m_GotoPosUpdateTimer.Start(); }
public void AttachToNavmesh(Navmesh nav_mesh) { Navmesh = nav_mesh; Navmesh.Navigator.AddListener(this); }
public UnexploredSelector(List <AABB> contraints, Func <ExploreCell, bool> filter, bool ignore_small, Vec3 agent_pos, Navmesh navmesh) { this.constraints = contraints; this.filter = filter; this.ignore_small = ignore_small; this.agent_pos = agent_pos; this.navmesh = navmesh; }