// Start is called before the first frame update void Start() { //initializing the terrain, getting the start and goal points float posy = Terrain.activeTerrain.SampleHeight(new Vector3(stt.position.x, 0, stt.position.z)); st = new Vector3(stt.position.x, posy, stt.position.z); float posyd = Terrain.activeTerrain.SampleHeight(new Vector3(got.position.x, 0, got.position.z)); go = new Vector3(got.position.x, posyd, got.position.z); //finding terrain limits terrainWidth = (int)moon.terrainData.size.x; terrainLength = (int)moon.terrainData.size.z; terrainPosX = (int)moon.transform.position.x; terrainPosZ = (int)moon.transform.position.z; planner = GetComponent <taskPlanner>(); //Creating a probability Road Map (PRM) // adding start and goal to the PRM Waypoint start = new Waypoint(0, st, 0, 0); //PRM = new List<Vector3>(); PRM.Add(st); PRM.Add(go); // adding n random points to the PRM, basically dividing the map into very small grids PRM.AddRange(sample_n(N, PRM)); Astar_init(); }
// Start is called before the first frame update void Start() { //initializing the terrain, getting the start and goal points float posy = Terrain.activeTerrain.SampleHeight(new Vector3(stt.position.x, 0, stt.position.z)); st = new Vector3(stt.position.x, posy, stt.position.z); float posyd = Terrain.activeTerrain.SampleHeight(new Vector3(got.position.x, 0, got.position.z)); go = new Vector3(got.position.x, posyd, got.position.z); //finding terrain limits anchor = st; terrainWidth = (int)moon.terrainData.size.x; terrainLength = (int)moon.terrainData.size.z; terrainPosX = (int)moon.transform.position.x; terrainPosZ = (int)moon.transform.position.z; planner = GetComponent <taskPlanner>(); //Creating a probability Road Map (PRM) // adding start and goal to the PRM Waypoint start = new Waypoint(0, st, 0, 0); //PRM = new List<Vector3>(); PRM.Add(st); PRM.Add(go); // adding n random points to the PRM, basically dividing the map into very small grids PRM.AddRange(sample_n(N, PRM)); //disp_cone(PRM, cone); path = new List <Vector3>(); O = new List <node>(); C = new List <node>(); E = new List <Edge>(); limit = 100000; ii = 0; isComplete = false; Destroy(destroy_later); destroy_later = new GameObject(); posy = Terrain.activeTerrain.SampleHeight(new Vector3(stt.position.x, 0, stt.position.z)); st = new Vector3(stt.position.x, posy, stt.position.z); float posyg = Terrain.activeTerrain.SampleHeight(new Vector3(got.position.x, 0, got.position.z)); go = new Vector3(got.position.x, posyg, got.position.z); PRM.Add(st); PRM.Add(go); O.Add(new node(st, 0, 0, 0, 0)); var nbst = O[0]; }
// Start is called before the first frame update void Start() { //initializing the terrain, getting the start and goal points T = new List <node>(); float posy = Terrain.activeTerrain.SampleHeight(new Vector3(stt.position.x, 0, stt.position.z)); st = new Vector3(stt.position.x, posy, stt.position.z); float posyg = Terrain.activeTerrain.SampleHeight(new Vector3(got.position.x, 0, got.position.z)); go = new Vector3(got.position.x, posyg, got.position.z); T.Add(new node(st, h_scale * Vector3.Distance(st, go), 0, 0, 0)); E = new List <Edge>(); V = new List <Vector3>(); X_soln = new List <node>(); //finding terrain limits terrainWidth = (int)moon.terrainData.size.x; terrainLength = (int)moon.terrainData.size.z; terrainPosX = (int)moon.transform.position.x; terrainPosZ = (int)moon.transform.position.z; V.Add(st); planner = GetComponent <taskPlanner>(); //Creating a probability Road Map (PRM) x_new = new node(); ii = 0; // adding start and goal to the PRM //Waypoint start = new Waypoint(0, st, 0, 0); //PRM = new List<Vector3>(); //PRM.Add(st); //PRM.Add(go); path = new List <Vector3>(); // adding n random points to the PRM, basically dividing the map into very small grids //PRM.AddRange(sample_n(N, PRM)); //Astar_init(); }