Skip to content

Commit

Permalink
Add moderate static navmesh demo for 3D
Browse files Browse the repository at this point in the history
  • Loading branch information
Scony committed May 16, 2022
1 parent 3d19b94 commit 95ad567
Show file tree
Hide file tree
Showing 5 changed files with 8,090 additions and 10 deletions.
56 changes: 56 additions & 0 deletions 3d/ModerateStaticNavmesh.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[gd_scene load_steps=6 format=2]

[ext_resource path="res://addons/godot-advanced-navigation-plugin/nodes/AdvancedNavigationMesh3D.gdns" type="Script" id=1]
[ext_resource path="res://addons/godot-advanced-navigation-plugin/advancednavigation.gdnlib" type="GDNativeLibrary" id=2]
[ext_resource path="res://assets/meshes/undulating.obj" type="ArrayMesh" id=3]

[sub_resource type="NativeScript" id=1]
class_name = "RecastPolygonMeshConfig"
library = ExtResource( 2 )

[sub_resource type="Resource" id=2]
script = SubResource( 1 )
partitioning/algorithm = 0
cell/size = 0.3
cell/height = 0.2
agent/radius = 2
agent/height = 5
agent/max_climb = 1
agent/max_slope = 70.0
edge/max_legth = 40
edge/max_error = 1.3
region/min_area = 64
region/merge_area = 400
polygon/max_verts_per_poly = 6
detail/sample_distance = 1.8
detail/sample_max_error = 1.0
filter/low_hanging_walkable_obstacles = true
filter/ledge_spans = true
filter/walkable_low_height_spans = true
custom_aabb_enabled/enabled = false
custom_aabb_enabled/bmin = Vector3( -10, -10, -10 )
custom_aabb_enabled/bmax = Vector3( 10, 10, 10 )
debug/pipeline_logs = false
debug/performance_logs = false

[node name="Demo" type="Spatial"]

[node name="AdvancedNavigationMesh3D" type="Spatial" parent="."]
script = ExtResource( 1 )
config = SubResource( 2 )

[node name="MeshInstance" type="MeshInstance" parent="AdvancedNavigationMesh3D"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5000, 0, -5000 )
mesh = ExtResource( 3 )
skeleton = NodePath("")

[node name="Camera" type="Camera" parent="."]
transform = Transform( 0.707107, -0.353553, 0.612372, 0, 0.866025, 0.5, -0.707107, -0.353553, 0.612372, 15, 8.331, 15 )
projection = 1
size = 10.0

[node name="DirectionalLight" type="DirectionalLight" parent="."]
transform = Transform( 0.94049, 0.175494, -0.290999, 0, 0.85633, 0.516429, 0.339822, -0.485696, 0.80537, 0, 0, 0 )
light_energy = 0.414
shadow_enabled = true
directional_shadow_mode = 0
20 changes: 11 additions & 9 deletions 3d/SimpleStaticNavmesh.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
[ext_resource path="res://addons/godot-advanced-navigation-plugin/nodes/AdvancedNavigationMesh3D.gdns" type="Script" id=1]
[ext_resource path="res://addons/godot-advanced-navigation-plugin/advancednavigation.gdnlib" type="GDNativeLibrary" id=2]

[sub_resource type="NativeScript" id=10]
class_name = "DetourNavigationMesh"
library = ExtResource( 2 )

[sub_resource type="Resource" id=11]
script = SubResource( 10 )
serialized_detour_navigation_mesh = PoolByteArray( 86, 65, 78, 68, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 20, 0, 0, 0, 32, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 128, 63, 154, 153, 25, 63, 205, 204, 76, 62, 0, 0, 240, 192, 0, 0, 32, 192, 0, 0, 240, 192, 0, 0, 240, 64, 0, 0, 96, 64, 0, 0, 240, 64, 85, 85, 85, 64, 102, 102, 102, 192, 224, 204, 204, 61, 50, 51, 83, 192, 51, 51, 211, 192, 224, 204, 204, 61, 0, 0, 64, 192, 51, 51, 211, 192, 224, 204, 204, 61, 52, 51, 211, 64, 0, 0, 0, 53, 224, 204, 204, 61, 52, 51, 211, 64, 52, 51, 211, 64, 224, 204, 204, 61, 52, 51, 211, 64, 52, 51, 211, 64, 224, 204, 204, 61, 0, 0, 0, 53, 52, 51, 211, 64, 224, 204, 204, 61, 51, 51, 211, 192, 153, 153, 121, 192, 224, 204, 204, 61, 51, 51, 211, 192, 50, 51, 83, 192, 224, 204, 204, 61, 0, 0, 64, 192, 0, 0, 64, 64, 224, 204, 204, 61, 50, 51, 83, 192, 52, 51, 83, 64, 224, 204, 204, 61, 0, 0, 64, 64, 0, 0, 64, 192, 224, 204, 204, 61, 52, 51, 83, 64, 100, 102, 230, 191, 224, 204, 204, 61, 100, 102, 230, 191, 100, 102, 230, 191, 224, 204, 204, 61, 104, 102, 230, 63, 104, 102, 230, 63, 224, 204, 204, 61, 104, 102, 230, 63, 104, 102, 230, 63, 224, 204, 204, 61, 100, 102, 230, 191, 100, 102, 230, 191, 206, 204, 44, 64, 100, 102, 230, 191, 100, 102, 230, 191, 206, 204, 44, 64, 104, 102, 230, 63, 104, 102, 230, 63, 206, 204, 44, 64, 104, 102, 230, 63, 104, 102, 230, 63, 206, 204, 44, 64, 100, 102, 230, 191, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 2, 0, 11, 0, 0, 0, 2, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 5, 63, 3, 0, 0, 0, 7, 0, 0, 0, 8, 0, 9, 0, 6, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 5, 63, 5, 0, 0, 0, 5, 0, 6, 0, 9, 0, 10, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 4, 63, 7, 0, 0, 0, 10, 0, 4, 0, 5, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 63, 9, 0, 0, 0, 11, 0, 2, 0, 3, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 63, 11, 0, 0, 0, 10, 0, 11, 0, 3, 0, 4, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 4, 63, 255, 255, 255, 255, 12, 0, 13, 0, 14, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 63, 255, 255, 255, 255, 16, 0, 17, 0, 18, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 63, 12, 0, 0, 0, 255, 255, 255, 255, 3, 255, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 10, 0, 0, 0, 255, 255, 255, 255, 3, 255, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 1, 255, 0, 0, 11, 0, 0, 0, 255, 255, 255, 255, 3, 255, 0, 0, 9, 0, 0, 0, 4, 0, 0, 0, 1, 255, 0, 0, 10, 0, 0, 0, 255, 255, 255, 255, 2, 255, 0, 0, 13, 0, 0, 0, 6, 0, 0, 0, 0, 255, 0, 0, 13, 0, 0, 0, 255, 255, 255, 255, 2, 255, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 0, 255, 0, 0, 11, 0, 0, 0, 255, 255, 255, 255, 3, 255, 0, 0, 12, 0, 0, 0, 10, 0, 0, 0, 1, 255, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 2, 0, 0, 1, 2, 0, 17, 2, 4, 0, 4, 2, 3, 4, 5, 1, 2, 0, 17, 2, 3, 0, 1, 3, 4, 0, 5, 3, 0, 2, 17, 0, 1, 2, 5, 2, 0, 1, 21, 2, 0, 1, 21, 1, 2, 0, 17, 2, 3, 0, 5, 3, 0, 2, 17, 0, 1, 2, 5, 3, 0, 2, 17, 0, 1, 2, 5 )

[sub_resource type="NativeScript" id=8]
class_name = "RecastPolygonMeshConfig"
library = ExtResource( 2 )
Expand All @@ -37,6 +29,16 @@ filter/walkable_low_height_spans = true
custom_aabb_enabled/enabled = false
custom_aabb_enabled/bmin = Vector3( -10, -10, -10 )
custom_aabb_enabled/bmax = Vector3( 0, 10, 0 )
debug/pipeline_logs = false
debug/performance_logs = false

[sub_resource type="NativeScript" id=10]
class_name = "DetourNavigationMesh"
library = ExtResource( 2 )

[sub_resource type="Resource" id=11]
script = SubResource( 10 )
serialized_detour_navigation_mesh = PoolByteArray( 86, 65, 78, 68, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 20, 0, 0, 0, 32, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 128, 63, 154, 153, 25, 63, 205, 204, 76, 62, 0, 0, 240, 192, 0, 0, 32, 192, 0, 0, 240, 192, 0, 0, 240, 64, 0, 0, 96, 64, 0, 0, 240, 64, 85, 85, 85, 64, 102, 102, 102, 192, 224, 204, 204, 61, 50, 51, 83, 192, 51, 51, 211, 192, 224, 204, 204, 61, 0, 0, 64, 192, 51, 51, 211, 192, 224, 204, 204, 61, 52, 51, 211, 64, 0, 0, 0, 53, 224, 204, 204, 61, 52, 51, 211, 64, 52, 51, 211, 64, 224, 204, 204, 61, 52, 51, 211, 64, 52, 51, 211, 64, 224, 204, 204, 61, 0, 0, 0, 53, 52, 51, 211, 64, 224, 204, 204, 61, 51, 51, 211, 192, 153, 153, 121, 192, 224, 204, 204, 61, 51, 51, 211, 192, 50, 51, 83, 192, 224, 204, 204, 61, 0, 0, 64, 192, 0, 0, 64, 64, 224, 204, 204, 61, 50, 51, 83, 192, 52, 51, 83, 64, 224, 204, 204, 61, 0, 0, 64, 64, 0, 0, 64, 192, 224, 204, 204, 61, 52, 51, 83, 64, 100, 102, 230, 191, 224, 204, 204, 61, 100, 102, 230, 191, 100, 102, 230, 191, 224, 204, 204, 61, 104, 102, 230, 63, 104, 102, 230, 63, 224, 204, 204, 61, 104, 102, 230, 63, 104, 102, 230, 63, 224, 204, 204, 61, 100, 102, 230, 191, 100, 102, 230, 191, 206, 204, 44, 64, 100, 102, 230, 191, 100, 102, 230, 191, 206, 204, 44, 64, 104, 102, 230, 63, 104, 102, 230, 63, 206, 204, 44, 64, 104, 102, 230, 63, 104, 102, 230, 63, 206, 204, 44, 64, 100, 102, 230, 191, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 2, 0, 11, 0, 0, 0, 2, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 5, 63, 3, 0, 0, 0, 7, 0, 0, 0, 8, 0, 9, 0, 6, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 5, 63, 5, 0, 0, 0, 5, 0, 6, 0, 9, 0, 10, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 4, 63, 7, 0, 0, 0, 10, 0, 4, 0, 5, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 63, 9, 0, 0, 0, 11, 0, 2, 0, 3, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 63, 11, 0, 0, 0, 10, 0, 11, 0, 3, 0, 4, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 4, 63, 255, 255, 255, 255, 12, 0, 13, 0, 14, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 63, 255, 255, 255, 255, 16, 0, 17, 0, 18, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 63, 12, 0, 0, 0, 255, 255, 255, 255, 3, 255, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 10, 0, 0, 0, 255, 255, 255, 255, 3, 255, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 1, 255, 0, 0, 11, 0, 0, 0, 255, 255, 255, 255, 3, 255, 0, 0, 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, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 2, 0, 0, 1, 2, 0, 17, 2, 4, 0, 4, 2, 3, 4, 5, 1, 2, 0, 17, 2, 3, 0, 1, 3, 4, 0, 5, 3, 0, 2, 17, 0, 1, 2, 5, 2, 0, 1, 21, 2, 0, 1, 21, 1, 2, 0, 17, 2, 3, 0, 5, 3, 0, 2, 17, 0, 1, 2, 5, 3, 0, 2, 17, 0, 1, 2, 5 )

[sub_resource type="PlaneMesh" id=1]
size = Vector2( 15, 15 )
Expand All @@ -56,8 +58,8 @@ size = Vector3( 2, 0.4, 2 )

[node name="AdvancedNavigationMesh3D" type="Spatial" parent="."]
script = ExtResource( 1 )
navigation_mesh = SubResource( 11 )
config = SubResource( 9 )
navigation_mesh = SubResource( 11 )

[node name="MeshInstance2" type="MeshInstance" parent="AdvancedNavigationMesh3D"]
mesh = SubResource( 1 )
Expand Down
Loading

0 comments on commit 95ad567

Please sign in to comment.