Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
pathfinding [2020/11/06 10:10] – [Computation] adminpathfinding [2020/11/06 10:20] – [Configuration] admin
Line 47: Line 47:
  
 <file pascal> <file pascal>
 +const
 +  PATHFINDING_GRID_X   = 128;
 +  PATHFINDING_GRID_Z   = 128;
 +  PATHFINDING_3DSIZE_X = 20;
 +  PATHFINDING_3DSIZE_Z = 20;
 +  
 var LGridSize : TPoint; var LGridSize : TPoint;
     LSize3D : TPointF;     LSize3D : TPointF;
Line 98: Line 104:
 FPathAnim.Start(); FPathAnim.Start();
 </file> </file>
 +
 +===== Update =====
 +
 +In case you want to update the map and path at runtime, you can use the following code snippet.
 +
 +<file pascal>
 +// new computation of path
 +FPathFinder.FindPath(Point3D(5, 0, 15));
 +
 +// refresh map in our image
 +FPathFinder.Draw(FVerifyBmp);
 +Image1.Bitmap.Assign(FVerifyBmp);
 +
 +// stop the current animation
 +FPathAnim.Stop();
 +FPathAnim.Enabled := false;
 +
 +// apply computed path data to our existing TGorillaPath3D instance, instead for recreating each time
 +FPathFinder.ApplyToPath3D(FPath);
 +
 +// reset the used path data in our path animation
 +FPathAnim.Path := FPath.Path;
 +</file>
 +
  
 ===== Visualize ===== ===== Visualize =====