-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusage.html
More file actions
1746 lines (1627 loc) · 117 KB
/
usage.html
File metadata and controls
1746 lines (1627 loc) · 117 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<title>Flying Navigation System Docs</title>
<!-- Meta -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="favicon.ico">
<link
href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800'
rel='stylesheet' type='text/css'>
<!-- FontAwesome JS -->
<script defer src="assets/fontawesome/js/all.js"></script>
<!-- Global CSS -->
<link rel="stylesheet" href="assets/plugins/bootstrap/css/bootstrap.min.css">
<!-- Plugins CSS -->
<link rel="stylesheet" href="assets/plugins/prism/prism.css">
<link rel="stylesheet" href="assets/plugins/lightbox/dist/ekko-lightbox.css">
<link rel="stylesheet" href="assets/plugins/elegant_font/css/style.css">
<!-- Theme CSS -->
<link id="theme-style" rel="stylesheet" href="assets/css/styles.css">
</head>
<body class="body-pink">
<div class="page-wrapper">
<!-- ******Header****** -->
<header id="header" class="header">
<div class="container">
<div class="branding">
<h1 class="logo">
<a href="index.html">
<span aria-hidden="true" class="arrow_carrot-2up_alt icon"></span>
<span class="text-highlight">Flying </span><span class="text-bold">Navigation System</span>
</a>
</h1>
</div><!--//branding-->
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="index.html">Home</a></li>
<li class="breadcrumb-item active">Usage</li>
</ol>
</div><!--//container-->
</header><!--//header-->
<div class="doc-wrapper">
<div class="container">
<div id="doc-header" class="doc-header text-center">
<h1 class="doc-title"><span aria-hidden="true" class="icon icon_puzzle_alt"></span> Usage</h1>
<div class="meta"><i class="far fa-clock"></i> Last updated: April 28rd, 2024</div>
</div><!--//doc-header-->
<div class="doc-body row">
<div class="doc-content col-md-9 col-12 order-1">
<div class="content-inner">
<section id="terminology" class="doc-section">
<h2 class="section-title">Terminology</h2>
<div id="recast" class="section-block">
<h4>Recast</h4>
<p>
<a href="https://github.com/recastnavigation/recastnavigation"
target="_blank">Recast</a> is a third-party library for automatic navmesh
generation, distributed with Unreal Engine.
This is the normal navigation you would be familiar with for NavWalking
characters.
</p>
</div><!--//section-block-->
<div id="UNavigationSystem" class="section-block">
<h4>UNavigationSystem</h4>
<p>
A singleton class owned by the <code>World</code> which handles all navigation
queries and building requests, delegating to the relevant
<code>NavigationData</code> actor.
It is implementation agnostic.
</p>
</div><!--//section-block-->
<div id="ANavigationData" class="section-block">
<h4>ANavigationData</h4>
<p>
This is an actor that is automatically spawned in the world when a
<code>NavMeshBoundsVolume</code> is added to the level.
This actor contains a specific navigation implementation.
<code>ARecastNavMesh</code> and <code>AFlyingNavigationData</code> are both
subclasses of <code>ANavigationData</code>, where <code>ARecastNavMesh</code>
implements Recast pathfinding and <code>AFlyingNavigationData</code> implements
a Sparse Voxel Octree for 3D pathfinding.
</p>
</div><!--//section-block-->
<div id="FNavAgentProperties" class="section-block">
<h4>FNavAgentProperties</h4>
<p>
Used in <code>Project Settings->Navigation System/Supported Agents</code> and
<code>UNavMovementComponent/Movement Capabilities</code>.
This is a simple struct that defines an agent to the navigation system.
It specifies the agent radius, height, step height and most importantly which
<code>ANavigationData</code> actor it uses for pathfinding.
To use the Flying Navigation System, set <code>PreferredNavData</code> to
<code>AFlyingNavigationData</code> in your flying Pawn's movement component.
</p>
<div class="callout-block callout-info">
<div class="icon-holder">
<i class="fas fa-info-circle"></i>
</div><!--//icon-holder-->
<div class="content">
<h4 class="callout-title">How the Navigation System chooses a
<code>NavigationData</code> for a given pawn
</h4>
<p>
The pawn must have a MovementComponent derived from
<code>UNavMovementComponent</code> in order to be involved in AI
pathfinding.
This includes <code>UPawnMovementComponent</code>, and therefore
<code>UFloatingPawnMovement</code> and
<code>UCharacterMovementComponent</code>.
<br>
<br>
<code>UNavMovementComponent</code> has a
<code>FNavAgentProperties</code> setting called
<code>Movement Capabilities</code>,
which determines what kind of agent the pawn is.
The Radius and Height can be auto-set with the
<code>Update Nav Agent With Owners Collision</code> option, but I
wouldn't recommend this for reasons detailed below.
<br>
<br>
Setting the <code>PreferredNavData</code> to
<code>FlyingNavigationData</code> will make sure the pawn uses the
Flying Navigation System.
However, sometimes you will want to build multiple octrees, one for a
large radius and one for a small radius.
In this case, you would set up multiple agents in Project Settings, each
with a different radius and/or height.
This will spawn multiple <code>FlyingNavigationData</code> actors in
your level, for which you can set different <code>MaxDetailSize</code>
etc.
<br>
<br>
Now, to choose which <code>FlyingNavigationData</code> to query, the
agent calls:
</p>
<pre><code class="language-cpp">NavSys->GetNavDataForProps(AgentProps, AsNavAgent->GetNavAgentLocation());</code></pre>
<p>
This function iterates through the available <code>NavigationData</code>
actors to find the one with the closest Radius and Height.
<br>
<br>
In essence, all this means is that the first priority is
<code>PreferredNavData</code>, then <code>AgentRadius</code> and
<code>AgentHeight</code>.
This is why I wouldn't recommend automatically setting the value with
the <code>Update Nav Agent With Owners Collision</code> option.
If you match up the values exactly between Project Settings and
<code>Movement Capabilities</code> everything should work as expected.
</p>
</div><!--//content-->
</div><!--//callout-block-->
</div><!--//section-block-->
<div id="Octree" class="section-block">
<h4>Octree</h4>
<p>
A data structure which partitions a 3D space by recursively subdividing a cube
into eight subcubes. Each node as 0 or 8 children.
A Sparse Voxel Octree (SVO) is an octree which is designed to have most of its
volume empty.
Storage space and computation time are concentrated in the detailed areas, and
not wasted in large open spaces.
</p>
<div class="text-center">
<a title="WhiteTimberwolf, PNG version: Nü, CC BY-SA 3.0 <http://creativecommons.org/licenses/by-sa/3.0/>, via Wikimedia Commons"
href="https://commons.wikimedia.org/wiki/File:Octree2.svg" target="_blank">
<img class="img-fluid" alt="Octree2"
src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/20/Octree2.svg/512px-Octree2.svg.png">
</a>
</div>
</div><!--//section-block-->
<div id="nodes" class="section-block">
<h4>Nodes and SubNodes</h4>
<p>
A node of the octree is one of those subdivisions in the diagram above.
It’s easiest to visualise it as a node of the tree on the right.
For memory efficiency, the Flying Navigation System also has SubNodes, due to
the way it stores the smallest voxels.
Each ‘Leaf node’ is actually a 4x4x4 voxel grid of SubNodes, stored in a 64-bit
integer.
As such, each SubNode uses 1 bit of space.
<code>Actual Voxel Size</code> in the <code>FlyingNavigationData</code>
properties refers to the size of these SubNodes.
For more details on how this works, please see <a
href="http://www.gameaipro.com/GameAIPro3/GameAIPro3_Chapter21_3D_Flight_Navigation_Using_Sparse_Voxel_Octrees.pdf"
target="_blank">3D Flight Navigation Using Sparse Voxel Octrees</a> by
Daniel Brewer.
</p>
</div><!--//section-block-->
<div id="NavigationOctree" class="section-block">
<h4>NavigationOctree</h4>
<p>
It is important to note that the <code>NavigationOctree</code> specifically is
not the SVO of the Flying Navigation System.
The <code>NavigationOctree</code> is a UE4 default octree structure owned by the
<code>NavigationSystem</code>, which stores the world geometry in an efficient
manner.
</p>
</div><!--//section-block-->
<div id="rasterization" class="section-block">
<h4>Rasterization (or Rasterisation)</h4>
<p>
In general, a process that converts a perfect mathematical representation (such
as an SVG image) of something into a regular grid (such as a bitmap image).
In video games this usually refers to converting a scene into screen pixels, but
in the Flying Navigation System rasterisation is the step in building the octree
in which voxels are tested against the world geometry to check if they
intersect.
The building process creates a version of the scene made entirely of voxels
("Volumetric Pixels").
</p>
</div><!--//section-block-->
<div id="async" class="section-block">
<h4>Async Processes</h4>
<p>
Most of the code we write for video games is run synchronously, which means its
designed to run in the same process as the <code>Tick</code> function.
If this code takes longer than a frame, then the framerate of the entire game
drops.
Asynchronous processes do not block the frame rate if they take too long, and
therefore can be used for intensive processes and calculated in the background.
All Octree building processes are asynchronous except for the visualisation.
Disabling <code>Allow Drawing in Game World</code> will make sure there will be
no drop in frame rate from dynamic rebuilding.
<br><br>
Pathfinding operations from <code>AI Move To</code>,
<code>Find Path To Actor/Location Synchronously</code> and behaviour trees are
all run on the main thread, and can cause frame rate drops with large scenes.
<code>Find Path To Actor/Location Asynchronously</code> along with the
<code>Request Move</code> node perform pathfinding in the background, this is
the recommended approach for scenes with many octree layers (Subdivisions > 7).
</p>
</div><!--//section-block-->
</section><!--//doc-section-->
<section id="nav-sys" class="doc-section">
<h2 class="section-title">Navigation System</h2>
<p>
To enable async pathfinding to take more than 1 frame to calculate (which may be
required for more complex queries), set the <code>Navigation System</code> property
in <code>World Settings</code> to be <code>Flying Navigation System</code> (since
plugin version 1.0.18). This does not interfere with any other navigation method,
including recast.
</p>
<div class="screenshot-holder">
<a href="assets/images/usage1.png" data-toggle="lightbox"
data-title="Navigation System class selection.">
<img class="img-fluid" src="assets/images/select_navigation_system.png"
alt="Dropdown in World Settings to select the Navigation System class." />
</a>
</div> <!--//screenshot-holder-->
</section><!--//doc-section-->
<section id="generation" class="doc-section">
<h2 class="section-title">Generation</h2>
<p>
For all of these properties, each time they're updated, the viewport display is also
updated.
For a responsive details panel, disable the <code>Enable Drawing</code> checkbox
before changing any values.
</p>
<div id="clear-data" class="section-block">
<h4>Clear Navigation Data</h4>
<p>Deletes SVO stored by this navigation data.</p>
</div><!--//section-block-->
<div id="rebuild-data" class="section-block">
<h4>Rebuild Navigation Data</h4>
<p>
Rebuilds SVO stored by this navigation data.
This button does the same thing as <code>Build->Build Paths</code> in the
toolbar.
</p>
</div><!--//section-block-->
<div id="cancel-rebuild" class="section-block">
<h4>Stop Rebuild</h4>
<p>
Cancels rebuild of SVO.
</p>
</div><!--//section-block-->
<div id="max-detail-size" class="section-block">
<h4>Max Detail Size</h4>
<p>Size in Unreal Units (cm) of the smallest details that can be captured. Display
only.</p>
</div><!--//section-block-->
<div id="subdivisions" class="section-block">
<h4>Subdivisions</h4>
<p>
Number of layers the Sparse Voxel Octree will generate, including the SubNode
layers. Display only.<br>
Updated on nav bounds or MaxDetailSize change.
</p>
</div><!--//section-block-->
<div id="actualvoxelsize" class="section-block">
<h4>Actual Voxel Size</h4>
<p>
Actual side length of the smallest voxels. Display only.<br>
Updated on nav bounds or MaxDetailSize change.
</p>
</div><!--//section-block-->
<div class="callout-block callout-info">
<div class="icon-holder">
<i class="fas fa-info-circle"></i>
</div><!--//icon-holder-->
<div class="content">
<h4 class="callout-title">How the Subdivisions and Actual Voxel Size values are
calculated</h4>
<p>
The SVO cube side length is the largest of the edges of the Nav Mesh Bounds
Volume.
The number of subdivisions is calculated as the lowest integer N such that
<code>(SideLength / 2^N) <= MaxDetailSize</code>.
In code, this is
</p>
<pre><code class="language-cpp">Subdivisions = FMath::CeilToInt(FMath::Log2(SideLength / MaxDetailSize));</code></pre>
<p>
ActualVoxelSize will update to the actual (smaller) voxel size when the nav
bounds or MaxDetailSize change,
to indicate the size of the SubNodes.
<br>
<br>
The actual voxel side length can be calculated as the inverse operation:
<code>ActualVoxelSize = SideLength / (2^Subdivisions).</code><br>
Due to the Ceiling operation, <code>ActualVoxelSize <= MaxDetailSize</code>.
<br>
<br>
Please note that the minimum number of subdivisions is 4, so the maximum
Actual Voxel Size is <code>SideLength / 16</code>.
</p>
</div><!--//content-->
</div><!--//callout-block-->
<div id="currently-built" class="section-block">
<h4>Currently Built</h4>
<p>
Shows if the cached nav data can be used for pathfinding. Display only.<br>
Updated on rebuild, nav bounds or MaxDetailSize change.
</p>
</div><!--//section-block-->
<div id="begin-play" class="section-block">
<h4>Build on Begin Play</h4>
<p>
When using <code>RuntimeGeneration = Dynamic</code>, whether to build once on
<code>BeginPlay</code>. <br>
Useful for procedurally generated levels.
</p>
<div class="callout-block callout-danger">
<div class="icon-holder">
<i class="fas fa-exclamation-triangle"></i>
</div><!--//icon-holder-->
<div class="content">
<h4 class="callout-title">Warning!</h4>
<p>
Large performance hit if used with very small detail size or very large
scene.
</p>
</div><!--//content-->
</div><!--//callout-block-->
</div><!--//section-block-->
<div id="multithreaded" class="section-block">
<h4>Multithreaded</h4>
<p>Build on multiple threads (highly recommended). Runs 8<sup>Thread Subdivisions
</sup> threads.</p>
</div><!--//section-block-->
<div id="ThreadSubdivisions" class="section-block">
<h4>Thread Subdivisions</h4>
<p>How many times to initially subdivide the generation volume. Runs each
subdivision on a separate thread. Increases the allowed minimum subdivisions.
</p>
</div><!--//section-block-->
<div id="max-threads" class="section-block">
<h4>Max Threads</h4>
<p>
Maximum number of threads to spawn when rasterising the level. If set to >=
available CPU threads, can lock your computer for a while.
</p>
</div><!--//section-block-->
<div id="use-agent-radius" class="section-block">
<h4>Use Agent Radius</h4>
<p>
Whether to expand the voxel collision test by the AgentRadius (See
<code>Project Settings->Navigation System</code>).
<br>
<br>
This is useful for making sure large agents don’t collide with objects.
The building process will expand triangles along their normals to ‘inflate’ the
geometry by the agent radius.
However, this option should be used with caution, as you don’t want small agents
to end up inside geometry.
</p>
</div><!--//section-block-->
<div class="callout-block callout-info">
<div class="icon-holder">
<i class="fas fa-info-circle"></i>
</div><!--//icon-holder-->
<div class="content">
<h4 class="callout-title">MaxDetailSize can be a better option than Use Agent
Radius</h4>
<p>
Instead of using this option, a larger <code>MaxDetailSize</code> is a good
and fast way to navigate scenes with a large agent.
Remember, you can build multiple octrees by specifying multiple agents in
<code>Project Settings->Navigation System/Supported Agents</code>.
</p>
</div><!--//content-->
</div><!--//callout-block-->
<div class="callout-block callout-warning">
<div class="icon-holder">
<i class="fas fa-bug"></i>
</div><!--//icon-holder-->
<div class="content">
<h4 class="callout-title">BSP level geometry</h4>
<p>
Utilising BSP level geometry with subtraction volumes can give inaccurate
results when using <code>Use Agent Radius</code>,
because the resulting mesh is non-watertight.
</p>
</div><!--//content-->
</div><!--//callout-block-->
</section><!--//doc-section-->
<section id="pathfinding" class="doc-section">
<h2 class="section-title">Pathfinding</h2>
<p>
The default query settings in the details panel of the FlyingNavigationData actor
are used by default,
if no AControllers implement the UFlyingObjectInterface.
</p>
<div id="algorithm" class="section-block">
<h4>Pathfinding Algorithm</h4>
<p>
Algorithm to use for pathfinding. <br>
A* is the fastest, but produces jagged paths (no line-of-sight checks). <br>
Theta* is the slowest and finds the shortest path. <br>
Lazy Theta* is faster but less accurate than Theta* (recommended).
</p>
</div><!--//section-block-->
<div id="partialpaths" class="section-block">
<h4>Allow Partial Paths</h4>
<p>
Whether to find a path despite the goal not being accessible.
</p>
<div class="callout-block callout-danger">
<div class="icon-holder">
<i class="fas fa-exclamation-triangle"></i>
</div><!--//icon-holder-->
<div class="content">
<h4 class="callout-title">Warning!</h4>
<p>
Can cause a large performance due to the algorithm searching the
entirety of the available space. Not recommended.
</p>
</div><!--//content-->
</div><!--//callout-block-->
</div><!--//section-block-->
<div id="heuristic-scale" class="section-block">
<h4>Heuristic Scale</h4>
<p>
How much to scale the A* heuristic by. High values can speed up pathfinding, at
the cost of accuracy.
All three pathfinding algorithms use the standard distance heuristic to speed up
processing time.
This scale weights the algorithm towards or away from using the heuristic, using
the following formula:
</p>
<pre><code class="language-cpp">float TotalCost = TraversalCost + DistanceToGoal * HeuristicScale;</code></pre>
</div><!--//section-block-->
<div id="unit-cost" class="section-block">
<h4>Use Unit Cost</h4>
<p>
Makes all nodes, regardless of size, the same cost. Speeds up pathfinding at the
cost of accuracy (AI prefers open spaces).
<br>
<br>
By default, the cost to traverse a node will be the distance between nodes.
However, this can make the algorithm spend lots of processing time in the dense
areas trying to find an optimal route.
By making each node cost the same, the algorithm can quickly find a path in open
spaces without looking through the smaller nodes.
</p>
</div><!--//section-block-->
<div id="node-compensation" class="section-block">
<h4>Use Node Compensation</h4>
<p>
Compensates node size even more, by multiplying node cost by 1 for a leaf node,
and 0.2 for the root node. It uses the following formula:
</p>
<pre><code class="language-cpp">TotalCost *= (1.f - LayerProportion * 0.8f);</code></pre>
<p>
Where <code>LayerProportion</code> is 0 for a leaf neighbour and 1 for the root
node.
</p>
</div><!--//section-block-->
<div id="pawn-centre" class="section-block">
<h4>Use Pawn Centre For Path Following</h4>
<p>
Compensate path points to make flying pawns follow the path through their
centre, rather than their feet.
<br>
<br>
Due to the fact the Flying Navigation System uses the existing navigation
infrastructure, there are certain default behaviours for walking nav agents that
are not useful for flying agents.
One of these is the <code>PathFollowingComponent</code> of the
<code>AIController</code>, which will move the pawn along the ‘feet’ location,
defined by the <code>Bounds.BoxExtent.Z</code> of the UpdatedComponent of the
MovementComponent.
This option will translate the path up to compensate, to make sure the pawn
flies through its centre.
</p>
</div><!--//section-block-->
<div id="debug-colour" class="section-block">
<h4>Debug Path Color</h4>
<p>
The color used to debug draw the navigation paths (see Display/DrawDebugPaths)
</p>
</div><!--//section-block-->
</section><!--//doc-section-->
<section id="geometry" class="doc-section">
<h2 class="section-title">Geometry</h2>
<div id="clear-geometry" class="section-block">
<h4>Clear Geometry Drawing</h4>
<p>
Clears lines from viewport. <br>
Calls <code>FlushPersistentDebugLines</code> to remove drawn debug geometry
(will clear other debug drawings).
</p>
</div><!--//section-block-->
<div id="draw-geometry" class="section-block">
<h4>Draw Geometry</h4>
<p>
Draw triangles the flying navigation system will use to rasterise octree.
Useful for checking functionality of Use Agent Radius, which expands geometry to
prevent clipping.
</p>
</div><!--//section-block-->
</section><!--//doc-section-->
<section id="display" class="doc-section">
<h2 class="section-title">Display</h2>
<p>It is recommended to test out these settings on a large max detail size, so the
viewport updates quickly.</p>
<div id="enable-drawing" class="section-block">
<h4>Enable Drawing</h4>
<p>If set to true then this navigation data will be drawing itself when requested as
part of "Show Navigation" (shortcut P).</p>
</div><!--//section-block-->
<div id="draw-nodes" class="section-block">
<h4>Draw Octree Nodes</h4>
<p>Whether to draw the Nodes of the Octree. This option does not apply to SubNodes.
</p>
</div><!--//section-block-->
<div id="draw-subnodes" class="section-block">
<h4>Draw Octree SubNodes</h4>
<p>Whether to draw the SubNodes of the Octree. This option does not apply to Nodes.
</p>
</div><!--//section-block-->
<div id="overlapped-subnodes" class="section-block">
<h4>Draw Only Overlapped SubNodes</h4>
<p>Draw only SubNodes that overlap geometry.</p>
</div><!--//section-block-->
<div id="colour-connected" class="section-block">
<h4>Colour By Connected</h4>
<p>Colours nodes based on which are connected sections. If disabled, colours from
Red to Blue based on layer (Red for root, Blue for SubNode).</p>
</div><!--//section-block-->
<div id="node-margin" class="section-block">
<h4>Node Margin</h4>
<p>
Amount to shrink display voxel extent by, to make it easier to read (absolute
measure).
Can be useful to prevent flickering with high Wire Thickness.
</p>
</div><!--//section-block-->
<div id="thickness" class="section-block">
<h4>Wire Thickness</h4>
<p>
Thickness of wire in octree visualisation, relative to box size. 1.0 is a solid
box. <br>
</p>
<div class="callout-block callout-danger">
<div class="icon-holder">
<i class="fas fa-exclamation-triangle"></i>
</div><!--//icon-holder-->
<div class="content">
<h4 class="callout-title">Warning!</h4>
<p>
Don't use as a slider because the viewport can lag if the octree is
built with a small detail size. Enter a discrete value instead.
</p>
</div><!--//content-->
</div><!--//callout-block-->
</div><!--//section-block-->
<div id="neighbour-connections" class="section-block">
<h4>Draw Neighbour Connections</h4>
<p>Whether to draw neighbour lines between Nodes and SubNodes. For connections
between SubNodes, the Draw Only Overlapped SubNodes should be
<code>false</code>.
</p>
<div class="callout-block callout-danger">
<div class="icon-holder">
<i class="fas fa-exclamation-triangle"></i>
</div><!--//icon-holder-->
<div class="content">
<h4 class="callout-title">Warning!</h4>
<p>
Uses slow drawing - do not use for high resolution visualisation.
</p>
</div><!--//content-->
</div><!--//callout-block-->
</div><!--//section-block-->
<div id="simplified" class="section-block">
<h4>Draw Simplified Connections</h4>
<p>
Whether to only draw node connections for performance and clarity.
Disable to show all connections, but not recommended.
</p>
</div><!--//section-block-->
<div id="node-radius" class="section-block">
<h4>Node Centre Radius</h4>
<p>
Radius of the sphere used to indicate each node centre.
</p>
</div><!--//section-block-->
<div id="debug-paths" class="section-block">
<h4>Draw Debug Paths</h4>
<p>Draw NavPath when queried (such as when MoveTo is called). Editor only.</p>
</div><!--//section-block-->
<div id="game-drawing" class="section-block">
<h4>Allow Drawing In Game World</h4>
<p>
Allow octree visualisation in PIE or Game World.
To see navigation in a game world, type <code>`</code> then
<code>show Navigation</code> (only in non-shipping builds).
</p>
<div class="callout-block callout-danger">
<div class="icon-holder">
<i class="fas fa-exclamation-triangle"></i>
</div><!--//icon-holder-->
<div class="content">
<h4 class="callout-title">Warning: Dynamic Rebuilding</h4>
<p>
Using a small detail size and hi-res level WILL cause a performance hit
when rebuilding in a game world.
This is what causes the performance hit, because the visualisation data
gathering runs on the game thread.
</p>
</div><!--//content-->
</div><!--//callout-block-->
</div><!--//section-block-->
</section><!--//doc-section-->
<section id="interface" class="doc-section">
<h2 class="section-title">UFlyingObjectInterface</h2>
<p>
By default, pathfinding queries will use the <code>Default Query Settings</code> of
the <code>Flying Navigation Data</code> (set in the details panel).
If you wish to override these on a per-agent basis, you can implement the
<code>UFlyingObjectInterface</code> in the appropriate <code>AController</code>.
It only requires one function, <code>Get Pathfinding Query Settings</code>, for
which you can make the required structure (or split the return pin).
These settings will override the defaults when this controller queries the
navigation data.
</p>
<div class="screenshot-holder">
<a href="assets/images/usage1.png" data-toggle="lightbox"
data-title="UFlyingObjectInterface usage">
<img class="img-fluid" src="assets/images/usage1.png"
alt="Get pathfinding query settings function" />
</a>
</div> <!--//screenshot-holder-->
</section><!--//doc-section-->
<section id="runtime" class="doc-section">
<h2 class="section-title">Runtime Generation</h2>
<p>
There are three ways to generate and store the octree data structure.
</p>
<ol>
<li>Static geometry: cached on disk and loaded into memory on level load.</li>
<li>Static procedural geometry: Generated once at the start of the level, no
caching.</li>
<li>Manually triggered generation: Only generated when RebuildFlyingNavigation is
called from Blueprints or C++.</li>
</ol>
<p>
For option 2 and 3, setting <code>RuntimeGeneration = Dynamic</code> is required.
</p>
<div class="callout-block callout-info">
<div class="icon-holder">
<i class="fas fa-info-circle"></i>
</div><!--//icon-holder-->
<div class="content">
<h4 class="callout-title">DynamicModifiersOnly option</h4>
<p>
<code>RuntimeGeneration = DynamicModifiersOnly</code> is the same as
<code>Static</code> for the Flying Navigation System, which doesn't support
modifiers.
</p>
</div><!--//content-->
</div><!--//callout-block-->
<p>
The <code>Build on Begin Play</code> option (under <code>Generation</code>) is
probably what you want for option 2.
<br>
<br>
Manually triggering a full-level rebuild is useful for opening a new area of the
map. For example, pressing a button opens a door. A rebuild can be triggered once
the door is open and stopped moving, allowing AI to move through it.
<br>
<br>
This can be achieved by the <code>Get Flying Navigation Data</code> function in
blueprints. The function takes a Pawn as reference and returns the corresponding
<code>FlyingNavigationData</code> actor. A rebuild of the data can be called on this
data (which rebuilds the nav data for the entire level), and optionally an
<code>On Flying Nav Generation Finished</code> delegate can be set up, to handle
unlocking the game.
<br>
<br>
Something like this in Blueprints:
</p>
<div class="screenshot-holder">
<a href="assets/images/usage2.png" data-toggle="lightbox"
data-title="Manually triggered rebuild">
<img class="img-fluid" src="assets/images/usage2.png"
alt="Manually triggered rebuild" />
</a>
</div> <!--//screenshot-holder-->
<p>
Remember, rebuilding is done asynchronously, so the
<code>Rebuild Navigation Data</code> node returning does not signify the completion
of the build.
<br>
<br>
The Pawn should contain a movement component of some kind, with
<code>AFlyingNavigationData</code> set in the <code>MovementCapabilities</code>
(otherwise the function will return <code>nullptr</code>).
<br>
<br>
Constantly moving objects such as moving platforms are not taken into account.
This is a limitation of the UE4 geometry gathering system, rather than the Flying
Navigation System (Recast has this limitation too).
<br>
<br>
It is recommended that a blocking volume is placed anywhere a moving object might
be, to prevent AI collision.
For example, a moving platform between two points:
</p>
<div class="screenshot-holder">
<a href="assets/images/usage3.png" data-toggle="lightbox"
data-title="Blocking Volume around Platform Path">
<img class="img-fluid" src="assets/images/usage3.png"
alt="Blocking Volume around Platform Path" />
</a>
</div> <!--//screenshot-holder-->
<p>After building:</p>
<div class="screenshot-holder">
<a href="assets/images/usage4.png" data-toggle="lightbox"
data-title="Blocking Volume around Platform Path">
<img class="img-fluid" src="assets/images/usage4.png"
alt="Blocking Volume around Platform Path" />
</a>
</div> <!--//screenshot-holder-->
</section><!--//doc-section-->
<section id="network" class="doc-section">
<h2 class="section-title">Network Replication</h2>
<p>
The flying navigation system uses the <code>ANavigationData</code> class for all
pathfinding, which is a server-only class by default (<code>bNetLoadOnClient</code>
is <code>false</code>).
This means that all AI pathfinding queries need to be done on the server, and that
trying to access the navigation system will return <code>nullptr</code> on a client.
<br>
<br>
You should use the <code>HasAuthority()</code> check before calling
<code>MoveTo</code> or similar on the <code>AIController</code>, and make sure actor
movement is replicated on the Pawn.
If you require pathfinding access for a player controller or similar, I believe the
best method is to use a Server RPC.
<br>
<br>
There is also the <code>Allow Client Side Navigation</code> option in
<code>Project Settings->Navigation System</code> which will replicate the navigation
system and navigation data actors to clients.
However, the SVO data is not replicated because it has the potential to use a lot of
bandwidth, so this option will not work.
If you require a solution of this kind please open an issue on <a
href="https://github.com/BlenderSleuth/FlyingNavSystemSupport/issues"
target="_blank">GitHub</a>.
</p>
</section><!--//doc-section-->
<section id="memory-usage" class="doc-section">
<h2 class="section-title">Checking Memory Usage</h2>
<p>
You can check roughly how much memory the octree is using by right-clicking the map
in the content explorer and opening the size map.
The octree memory is inside the <code>*SELF*</code> section, which will expand as
you add more layers to the tree.
It also contains other things, but at small detail sizes it can be the majority.
</p>
<div class="screenshot-holder">
<a href="assets/images/usage5.png" data-toggle="lightbox"
data-title="Octree Memory Usage in a Level">
<img class="img-fluid" src="assets/images/usage5.png"
alt="Octree Memory Usage in a Level" />
</a>
</div> <!--//screenshot-holder-->
</section><!--//doc-section-->
<section id="compile-recast" class="doc-section">
<h2 class="section-title">Turning off bCompileRecast</h2>
<p>
I was considering allowing support for the compile-time parameter
<code>bCompileRecast = false</code>, for small mobile builds.
The plugin currently piggy-backs off the Recast geometry gathering code, so I would
need to duplicate much of it for the Flying Navigation System to continue to work.
However, I was not able to get the engine Shipping target (even without the plugin)
to compile without Recast.
Please open an issue on <a
href="https://github.com/BlenderSleuth/FlyingNavSystemSupport/issues"
target="_blank">GitHub</a> if this is something you require.
</p>
</section><!--//doc-section-->
<section id="blueprint" class="doc-section">
<h2 class="section-title">Blueprint Functions</h2>
<p>These functions can be called from anywhere.</p>
<div id="get-navdata" class="section-block">
<h4>Get Flying Navigation Data</h4>
<p>
Get the <code>FlyingNavigationData</code> actor for a given Pawn. <br>
Will return <code>nullptr</code> if the Pawn's movement component specifies a
different <code>Preferred Nav Data</code>.
</p>
<div class="screenshot-holder">
<img class="img-fluid" src="assets/images/usage6.png"
alt="Get Flying Navigation Data node" />
</div> <!--//screenshot-holder-->
<p>It's recommended that you use an <code>Is Valid</code> node to make sure the
return value exists.</p>
</div><!--//section-block-->
<div id="rebuild-all-flying-nav" class="section-block">
<h4>Rebuild All Flying Navigation</h4>
<p>
Rebuild all Flying Navigation Data agents. <br>
To build a specific navigation data, use <code>Get Flying Navigation Data</code>
and call <code>Rebuild Navigation Data</code> on it.
</p>
<div class="screenshot-holder">
<img class="img-fluid" src="assets/images/usage7.png"
alt="Rebuild All Flying Navigation node" />
</div> <!--//screenshot-holder-->
</div><!--//section-block-->
<div id="rebuild-navdata" class="section-block">
<h4>Rebuild Navigation Data / Rebuild Flying Navigation</h4>
<p>
Rebuild cached SVO Data for the given Flying Navigation Actor.
<code>Rebuild Navigation Data</code> will return instantly and not wait for the
building to complete.
<code>Rebuild Flying Navigation</code> will only trigger once building is
completed (or cancelled).
</p>
<div class="screenshot-holder">
<img class="img-fluid" src="assets/images/usage8.png"
alt="Rebuild Navigation Data and Rebuild Flying Navigation nodes" />
</div> <!--//screenshot-holder-->
</div><!--//section-block-->
<div class="callout-block callout-danger">
<div class="icon-holder">
<i class="fas fa-exclamation-triangle"></i>
</div><!--//icon-holder-->
<div class="content">
<h4 class="callout-title">Warning: Dynamic Rebuilding</h4>
<p>
Using a small detail size and hi-res level can cause a performance hit when
rebuilding. Use with caution (and profiling).
Turning off <code>Allow Drawing In Game World</code> helps.
</p>
</div><!--//content-->
</div><!--//callout-block-->
<div id="stop-rebuild" class="section-block">
<h4>Stop Rebuild</h4>
<p>
Cancels rebuild of cached Navigation Data.
Will trigger <code>Rebuild Flying Navigation</code> completed pin,
so check <code>Is Navigation Data Built</code> to make sure data is available.
Rebuild will not overwrite data until completed.
</p>
<div class="screenshot-holder">
<img class="img-fluid" src="assets/images/usage9.png" alt="Stop Rebuild node" />
</div> <!--//screenshot-holder-->
</div><!--//section-block-->
<div id="data-built" class="section-block">
<h4>Is Navigation Data Built</h4>
<p>
Checks if navigation data is available for pathfinding or raycasting.
</p>
<div class="screenshot-holder">
<img class="img-fluid" src="assets/images/usage10.png"
alt="Is Navigation Data Built node" />
</div> <!--//screenshot-holder-->
</div><!--//section-block-->
<div id="built-voxel-size" class="section-block">
<h4>Currently Built Voxel Size</h4>
<p>
Returns voxel size of currently built navigation data. Returns 0 if not built.
</p>
<div class="screenshot-holder">
<img class="img-fluid" src="assets/images/usage11.png"
alt="Is Navigation Data Built node" />
</div> <!--//screenshot-holder-->
</div><!--//section-block-->
<div id="raycast" class="section-block">
<h4>Octree Raycast</h4>
<p>
Fast raycast against the octree. Returns true if object was hit.
</p>
<div class="screenshot-holder">
<img class="img-fluid" src="assets/images/usage12.png"
alt="Octree raycast node" />
</div> <!--//screenshot-holder-->
</div><!--//section-block-->
<div id="draw-navpath" class="section-block">
<h4>Draw Nav Path (Development Only)</h4>
<p>
Draw the navigation path returned by the
<code>Find Path To Actor/Location Synchronously/Asynchronously</code> node.
<code>Path Offset</code> will translate the path by a fixed amount.
<code>Persistent</code> draws will persist between frames.
</p>
<div class="screenshot-holder">
<img class="img-fluid" src="assets/images/usage13.png"
alt="Draw Nav Path node" />
</div> <!--//screenshot-holder-->
</div><!--//section-block-->
<div id="pathfind-location" class="section-block">
<h4>Find Path To Location Asynchronously</h4>
<p>
Finds path on separate thread. The <code>Completed</code> pin is triggered once
a path has been found<br>
The <code>Pathfinding Context</code> could be one of following:
<code>NavigationData</code> (like <code>FlyingNavigationData</code> actor),
<code>Pawn</code> or <code>Controller</code>.
This parameter determines which navigation data actor is chosen and allows
override of SVO Query Settings (see <a
href="usage.html#interface">UFlyingObjectInterface</a>).
</p>
<div class="screenshot-holder">
<img class="img-fluid" src="assets/images/usage14.png"
alt="Find Path To Location Asynchronously" />
</div> <!--//screenshot-holder-->
</div><!--//section-block-->
<div id="pathfind-actor" class="section-block">
<h4>Find Path To Actor Asynchronously</h4>
<p>
Finds path on separate thread. The <code>Completed</code> pin is triggered once
a path has been found<br>
Main advantage over <code>Find Path To Location Asynchronously</code> is that
the resulting path will automatically get updated if the goal actor moves more
than <code>Tether Distance</code> away from last path node.
Updates when the <code>Goal Actor</code> moves are also asynchronous, but only
when doing Flying pathfinding (Recast query updates are processed in the usual
fashion).
The <code>Pathfinding Context</code> could be one of following:
<code>NavigationData</code> (like <code>FlyingNavigationData</code> actor),
<code>Pawn</code> or <code>Controller</code>.
This parameter determines which navigation data actor is chosen and allows
override of SVO Query Settings (see <a
href="usage.html#interface">UFlyingObjectInterface</a>).
</p>
<div class="screenshot-holder">
<img class="img-fluid" src="assets/images/usage15.png"
alt="Find Path To Location Asynchronously" />
</div> <!--//screenshot-holder-->
<p>This can be used in a setup similar to the following:</p>
<div class="screenshot-holder">
<img class="img-fluid" src="assets/images/usage16_1.png"
alt="Find Path To Actor Asynchronously use case" />
</div> <!--//screenshot-holder-->
<p>
On <code>BeginPlay</code>, the actor tries to find a path to the player. Before
the pathfinding completes, <code>BeginPlay</code> exits and the level loads
normally.
The <code>Tick</code> event runs every frame, but doesn't do anything because
the <code>Found Path</code> variable is invalid.
Once the pathfinding is finished, the <code>Completed</code> pin triggers, and
saves the path in <code>Found Path</code>.
<code>Tick</code> can now run <code>Draw Nav Path</code> each frame, and as the
player moves the path will update periodically without stalling the game thread.
</p>
</div><!--//section-block-->
<div class="callout-block callout-info">
<div class="icon-holder">
<i class="fas fa-info-circle"></i>
</div><!--//icon-holder-->
<div class="content">
<h4 class="callout-title">Pathfinding Context</h4>
<p>
When using the
<code>Find Path To Actor/Location Synchronously/Asynchronously</code> family
of nodes, to prevent bugs it’s a good idea
to use the controlled pawn (<code>GetControlledPawn</code> from a