feat: bake jajce terrain navigation
This commit is contained in:
@@ -17,7 +17,7 @@ func _run() -> void:
|
||||
var world: Node3D = load("res://world/jajce/JajceWorld.tscn").instantiate()
|
||||
root.add_child(world)
|
||||
await process_frame
|
||||
for frame in 10:
|
||||
for _frame in 10:
|
||||
await physics_frame
|
||||
|
||||
var terrain = world.get_node("TerrainRoot/Terrain3D")
|
||||
@@ -27,10 +27,9 @@ func _run() -> void:
|
||||
"Terrain3D should use dedicated Jajce data"
|
||||
)
|
||||
_check(terrain.collision_mode != 0, "Terrain3D collision should be enabled for gameplay")
|
||||
var greybox_ground := world.get_node("NavigationRegion3D/GreyboxGround") as StaticBody3D
|
||||
_check(
|
||||
greybox_ground.collision_layer == 0 and greybox_ground.collision_mask == 0,
|
||||
"GreyboxGround should not provide runtime physics collision"
|
||||
not world.has_node("NavigationRegion3D/GreyboxGround"),
|
||||
"JajceWorld should not keep the temporary greybox navigation ground"
|
||||
)
|
||||
_check(
|
||||
configured_texture_count == 6,
|
||||
@@ -203,6 +202,10 @@ func _run() -> void:
|
||||
navigation_region.navigation_mesh.get_polygon_count() > 0,
|
||||
"Jajce navigation mesh should contain baked polygons"
|
||||
)
|
||||
_check(
|
||||
navigation_region.navigation_mesh.resource_path == "res://world/jajce/JajceNavigationMesh.tres",
|
||||
"Jajce navigation should use the Terrain3D-derived baked mesh resource"
|
||||
)
|
||||
await _wait_for_navigation_map(navigation_map)
|
||||
NavigationServer3D.map_force_update(navigation_map)
|
||||
|
||||
@@ -224,6 +227,9 @@ func _run() -> void:
|
||||
_check_path_tracks_terrain(
|
||||
terrain, path, "Jajce navigation path should track Terrain3D height"
|
||||
)
|
||||
_check_path_reaches_destination(
|
||||
path, destination, "Jajce navigation path should reach its requested target"
|
||||
)
|
||||
|
||||
var adapter := ActiveWorldAdapter.new()
|
||||
adapter.pantry_storage = pantry
|
||||
@@ -330,3 +336,17 @@ func _check_path_tracks_terrain(terrain: Terrain3D, path: PackedVector3Array, me
|
||||
% [message, point, terrain_height]
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
func _check_path_reaches_destination(path: PackedVector3Array, destination: Vector3, message: String) -> void:
|
||||
if path.is_empty():
|
||||
return
|
||||
|
||||
var final_point := path[path.size() - 1]
|
||||
var final_xz := Vector2(final_point.x, final_point.z)
|
||||
var destination_xz := Vector2(destination.x, destination.z)
|
||||
if final_xz.distance_to(destination_xz) > 1.5:
|
||||
failures.append(
|
||||
"%s: final path point %s is too far from %s"
|
||||
% [message, final_point, destination]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user