public Triangle(int vertexIndex1, int vertexIndex2, int vertexIndex3, SphericalNavMesh father) { this.father = father; vertexIndeces = new int[3]; vertexIndeces[0] = vertexIndex1; vertexIndeces[1] = vertexIndex2; vertexIndeces[2] = vertexIndex3; normal = Vector3.Cross(GetVertex(1) - GetVertex(0), GetVertex(2) - GetVertex(0)).normalized; //collidingRadius = Vector3.Distance((GetVertex(1) + GetVertex(0)) / 2f, GetCenter()); }
protected void OnCollisionStay(Collision other) { if (other.gameObject.CompareTag("Ground")) { currentPlanet = other.gameObject; navSurface = currentPlanet.GetComponent <SphericalNavMesh>(); if (updateNavigationPath && !isComputing() && navSurface.IsUpdatedCorrectly()) { StartCoroutine(BeginAStar()); } } }
protected void LateUpdate() { if (path == null || path.Count == 0) { return; } if (!alreadySimplified) { path = GetSimplifiedPath(path); } //only for debug List <Vector3> vertices = new List <Vector3>(); path.ForEach(n => { vertices.Add(n.vertex); }); SphericalNavMesh.DebugPath(vertices.ToArray(), Color.cyan); }
public void Init() { navMesh = UnityEngine.GameObject.FindGameObjectWithTag("Ground").GetComponent <SphericalNavMesh>(); navMesh.ComputeMeshData(); }