Pathfinding.TriangleMeshNode.UpdatePositionFromVertices C# (CSharp) Method

UpdatePositionFromVertices() public method

public UpdatePositionFromVertices ( ) : void
return void
		public void UpdatePositionFromVertices () {
			INavmeshHolder g = GetNavmeshHolder(GraphIndex);
			position = (g.GetVertex(v0) + g.GetVertex(v1) + g.GetVertex(v2)) * 0.333333f;
		}
		

Usage Example

Ejemplo n.º 1
0
 public override void RelocateNodes(Matrix4x4 oldMatrix, Matrix4x4 newMatrix)
 {
     if (this.vertices == null || this.vertices.Length == 0 || this.originalVertices == null || this.originalVertices.Length != this.vertices.Length)
     {
         return;
     }
     for (int i = 0; i < this._vertices.Length; i++)
     {
         this._vertices[i] = (Int3)newMatrix.MultiplyPoint3x4(this.originalVertices[i]);
     }
     for (int j = 0; j < this.nodes.Length; j++)
     {
         TriangleMeshNode triangleMeshNode = this.nodes[j];
         triangleMeshNode.UpdatePositionFromVertices();
         if (triangleMeshNode.connections != null)
         {
             for (int k = 0; k < triangleMeshNode.connections.Length; k++)
             {
                 triangleMeshNode.connectionCosts[k] = (uint)(triangleMeshNode.position - triangleMeshNode.connections[k].position).costMagnitude;
             }
         }
     }
     base.SetMatrix(newMatrix);
     NavMeshGraph.RebuildBBTree(this);
 }
All Usage Examples Of Pathfinding.TriangleMeshNode::UpdatePositionFromVertices