Rough collision avoidance implementation using pre-generated floors (just floor 01)
This commit is contained in:
8
src/map/dungeon/NavigationMesh.tres
Normal file
8
src/map/dungeon/NavigationMesh.tres
Normal file
@@ -0,0 +1,8 @@
|
||||
[gd_resource type="NavigationMesh" format=3 uid="uid://d3n1gyxfjcm5u"]
|
||||
|
||||
[resource]
|
||||
vertices = PackedVector3Array(-39, -1.46346, -18.25, -29.25, -1.46346, -18, -29, -1.46346, -20.25, -28.25, -1.46346, -21, -26.25, -1.46346, -39, -39, -1.46346, -39, -26.25, -1.46346, -21, -13.5, -1.46346, -21, -13.5, -1.46346, -39, -11.5, -1.46346, -21, -10.75, -1.46346, -20.25, 39, -1.46346, -39, -10.75, -1.46346, -1, 39, -1.46346, -0.75, -25.25, -1.46346, -15.75, -26.5, -1.46346, -15, -26.5, -1.46346, -13, -21, -1.46346, -12, -18, -1.46346, -11.25, -18, -1.46346, -10, -13.25, -1.46346, -10, -13.25, -1.46346, -15, -14, -1.46346, -15, -14.75, -1.46346, -15.75, -18.75, -1.46346, -12, -14.5, -1.46346, -18.5, -25.25, -1.46346, -18.5, -39, -1.46346, -13.75, -29, -1.46346, -13.75, -29, -1.46346, -8.25, -28, -1.46346, -9, -28, -1.46346, -11, -29, -1.46346, -11.75, -39, -1.46346, -6.25, -29, -1.46346, -6.25, -27, -1.46346, -8.5, -26.75, -1.46346, -11.75, -26.5, -1.46346, -6.75, -21, -1.46346, -8, -22, -1.46346, -8.75, -22, -1.46346, -11.25, -26.5, -1.46346, -4.75, -25.25, -1.46346, -4, -18, -1.46346, -8.75, -14, -1.46346, -4.75, -13.25, -1.46346, -4.75, -18.75, -1.46346, -8, -14.75, -1.46346, -4, -25.5, -1.46346, -1.25, -14.5, -1.46346, -1.25, -29.25, -1.46346, -1.75, -39, -1.46346, -1.5, -29, -1.46346, 0.5, -28.25, -1.46346, 1.25, -39, -1.46346, 39, -12.75, -1.46346, 39, -13, -1.46346, 1.25, -11.5, -1.46346, 1.25, -10.75, -1.46346, 0.5, 39, -1.46346, 39)
|
||||
polygons = [PackedInt32Array(2, 1, 0), PackedInt32Array(2, 0, 3), PackedInt32Array(3, 0, 5), PackedInt32Array(3, 5, 4), PackedInt32Array(4, 6, 3), PackedInt32Array(4, 8, 6), PackedInt32Array(6, 8, 7), PackedInt32Array(9, 7, 8), PackedInt32Array(9, 8, 10), PackedInt32Array(10, 8, 11), PackedInt32Array(12, 10, 13), PackedInt32Array(13, 10, 11), PackedInt32Array(15, 14, 16), PackedInt32Array(16, 14, 17), PackedInt32Array(20, 19, 18), PackedInt32Array(22, 21, 20), PackedInt32Array(18, 24, 20), PackedInt32Array(20, 24, 22), PackedInt32Array(22, 24, 23), PackedInt32Array(24, 17, 23), PackedInt32Array(23, 17, 25), PackedInt32Array(25, 17, 14), PackedInt32Array(25, 14, 26), PackedInt32Array(0, 1, 27), PackedInt32Array(27, 1, 28), PackedInt32Array(30, 29, 31), PackedInt32Array(31, 29, 32), PackedInt32Array(32, 29, 33), PackedInt32Array(32, 33, 27), PackedInt32Array(27, 28, 32), PackedInt32Array(29, 34, 33), PackedInt32Array(30, 31, 35), PackedInt32Array(35, 31, 36), PackedInt32Array(39, 38, 37), PackedInt32Array(36, 16, 35), PackedInt32Array(35, 16, 37), PackedInt32Array(37, 16, 39), PackedInt32Array(39, 16, 40), PackedInt32Array(16, 17, 40), PackedInt32Array(41, 37, 42), PackedInt32Array(42, 37, 38), PackedInt32Array(43, 19, 20), PackedInt32Array(20, 45, 44), PackedInt32Array(43, 20, 46), PackedInt32Array(46, 20, 44), PackedInt32Array(46, 44, 47), PackedInt32Array(46, 47, 38), PackedInt32Array(38, 47, 49), PackedInt32Array(38, 49, 42), PackedInt32Array(42, 49, 48), PackedInt32Array(51, 33, 50), PackedInt32Array(50, 33, 34), PackedInt32Array(52, 51, 50), PackedInt32Array(52, 53, 51), PackedInt32Array(51, 53, 54), PackedInt32Array(56, 55, 53), PackedInt32Array(53, 55, 54), PackedInt32Array(55, 56, 57), PackedInt32Array(57, 58, 55), PackedInt32Array(55, 58, 59), PackedInt32Array(59, 58, 13), PackedInt32Array(58, 12, 13)]
|
||||
geometry_parsed_geometry_type = 1
|
||||
geometry_collision_mask = 2147483648
|
||||
agent_radius = 1.0
|
||||
@@ -19,6 +19,4 @@ public partial class BossFloor : Node3D, IDungeonFloor
|
||||
}
|
||||
|
||||
public Transform3D GetPlayerSpawnPoint() => BossRoom.PlayerSpawn.GlobalTransform;
|
||||
|
||||
public Vector3 GetTeleportSpawnPoint() => BossRoom.TeleportSpawn.GlobalPosition;
|
||||
}
|
||||
|
||||
@@ -11,8 +11,6 @@ public partial class BossRoomA : Node3D, IBossRoom
|
||||
|
||||
[Node] public Marker3D PlayerSpawn { get; set; } = default!;
|
||||
|
||||
[Node] public Marker3D TeleportSpawn { get; set; } = default!;
|
||||
|
||||
[Node] public Node3D HorseHeadStatue { get; set; } = default!;
|
||||
|
||||
[Node] public Node3D OxFaceStatue { get; set; } = default!;
|
||||
|
||||
@@ -13,8 +13,6 @@ namespace GameJamDungeon
|
||||
|
||||
[Node] public GodotObject DungeonGenerator { get; set; } = default!;
|
||||
|
||||
[Node] public NavigationRegion3D NavigationRegion3D { get; set; } = default!;
|
||||
|
||||
[Node] public EnemyDatabase EnemyDatabase { get; set; } = default!;
|
||||
|
||||
private Transform3D _playerSpawnPoint;
|
||||
@@ -23,13 +21,12 @@ namespace GameJamDungeon
|
||||
|
||||
public void InitializeDungeon()
|
||||
{
|
||||
Rooms = new List<MonsterRoom>();
|
||||
DungeonGenerator.Call("generate");
|
||||
NavigationRegion3D.BakeNavigationMesh();
|
||||
Rooms = [];
|
||||
Rooms = FindAllDungeonRooms([.. GetChildren()], Rooms);
|
||||
_playerSpawnPoint = RandomizePlayerSpawnPoint();
|
||||
foreach (var room in Rooms)
|
||||
room.SpawnEnemies(EnemyDatabase);
|
||||
DungeonGenerator.EmitSignal("done_generating");
|
||||
}
|
||||
|
||||
public Transform3D GetPlayerSpawnPoint() => _playerSpawnPoint;
|
||||
@@ -52,9 +49,14 @@ namespace GameJamDungeon
|
||||
return roomsFound;
|
||||
|
||||
foreach (var node in nodesToSearch)
|
||||
{
|
||||
if (node is MonsterRoom dungeonRoom)
|
||||
roomsFound.Add(dungeonRoom);
|
||||
|
||||
if (node.HasSignal("dungeon_done_generating"))
|
||||
node.EmitSignal("dungeon_done_generating");
|
||||
}
|
||||
|
||||
return FindAllDungeonRooms(nodesToSearch.SelectMany(x => x.GetChildren()).ToList(), roomsFound);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=58 format=4 uid="uid://dpec2lbt83dhe"]
|
||||
[gd_scene load_steps=59 format=4 uid="uid://dpec2lbt83dhe"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ce73fuh74l81l" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="1_ho6e8"]
|
||||
[ext_resource type="Script" uid="uid://dhollu4j3pynq" path="res://src/map/dungeon/code/MonsterRoom.cs" id="2_phhs1"]
|
||||
@@ -645,6 +645,9 @@ _surfaces = [{
|
||||
blend_shape_mode = 0
|
||||
shadow_mesh = SubResource("ArrayMesh_i3ffh")
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_phhs1"]
|
||||
size = Vector3(2.12268, 5.82227, 1.63702)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_51rrf"]
|
||||
shading_mode = 0
|
||||
albedo_texture = ExtResource("20_le1vp")
|
||||
@@ -679,6 +682,8 @@ script = ExtResource("2_phhs1")
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="Antechamber A"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.10505, -1.44377, 0.0953512)
|
||||
collision_layer = 2147483649
|
||||
collision_mask = 2147483649
|
||||
|
||||
[node name="ROOM" type="MeshInstance3D" parent="Antechamber A/StaticBody3D"]
|
||||
transform = Transform3D(0.287429, 0, 0, 0, 0.287429, 0, 0, 0, 0.287429, 2.1526, 3.44987, -0.0743999)
|
||||
@@ -759,6 +764,19 @@ unique_name_in_owner = true
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.33663, -1.49877, 0.845012)
|
||||
|
||||
[node name="StaticBody3D2" type="StaticBody3D" parent="Antechamber A"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -87.0242)
|
||||
collision_layer = 2147483648
|
||||
collision_mask = 2147483648
|
||||
|
||||
[node name="CollisionShape3D7" type="CollisionShape3D" parent="Antechamber A/StaticBody3D2"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.49594, -0.677457, 94.6461)
|
||||
shape = SubResource("BoxShape3D_phhs1")
|
||||
|
||||
[node name="CollisionShape3D8" type="CollisionShape3D" parent="Antechamber A/StaticBody3D2"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.66204, -0.677457, 94.7863)
|
||||
shape = SubResource("BoxShape3D_phhs1")
|
||||
|
||||
[node name="CSGBox3D" type="CSGBox3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0314088, 4.23029, -0.0385468)
|
||||
visible = false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=65 format=4 uid="uid://b82dx66mgs2d7"]
|
||||
[gd_scene load_steps=66 format=4 uid="uid://b82dx66mgs2d7"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ce73fuh74l81l" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="1_0qew1"]
|
||||
[ext_resource type="Script" uid="uid://dhollu4j3pynq" path="res://src/map/dungeon/code/MonsterRoom.cs" id="2_pu81k"]
|
||||
@@ -700,6 +700,9 @@ _surfaces = [{
|
||||
blend_shape_mode = 0
|
||||
shadow_mesh = SubResource("ArrayMesh_jks6o")
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_pu81k"]
|
||||
size = Vector3(2.12268, 5.82227, 1.63702)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_bnx07"]
|
||||
albedo_texture = ExtResource("3_xx585")
|
||||
texture_filter = 0
|
||||
@@ -752,6 +755,8 @@ mesh = SubResource("ArrayMesh_sx1ls")
|
||||
skeleton = NodePath("")
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="BasinRoom/BASIN_ROOM_VER2"]
|
||||
collision_layer = 2147483649
|
||||
collision_mask = 2147483649
|
||||
|
||||
[node name="ROOM_001" type="MeshInstance3D" parent="BasinRoom/BASIN_ROOM_VER2/StaticBody3D"]
|
||||
transform = Transform3D(0.35918, 0, 0, 0, 0.287429, 0, 0, 0, 0.287429, -3.6523, 13.6997, 102.523)
|
||||
@@ -829,9 +834,17 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.55, -2.55692, 0)
|
||||
[node name="ItemDatabase" parent="BasinRoom/BASIN_ROOM_VER2" instance=ExtResource("18_bwap2")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="TeleportSpawn" type="Marker3D" parent="BasinRoom/BASIN_ROOM_VER2"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.28791, 10.2563, 106.274)
|
||||
[node name="StaticBody3D2" type="StaticBody3D" parent="BasinRoom/BASIN_ROOM_VER2"]
|
||||
collision_layer = 2147483648
|
||||
collision_mask = 2147483648
|
||||
|
||||
[node name="CollisionShape3D7" type="CollisionShape3D" parent="BasinRoom/BASIN_ROOM_VER2/StaticBody3D2"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.86587, 12.1211, 94.6461)
|
||||
shape = SubResource("BoxShape3D_pu81k")
|
||||
|
||||
[node name="CollisionShape3D8" type="CollisionShape3D" parent="BasinRoom/BASIN_ROOM_VER2/StaticBody3D2"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.03197, 12.1211, 94.7863)
|
||||
shape = SubResource("BoxShape3D_pu81k")
|
||||
|
||||
[node name="CSGBox3D" type="CSGBox3D" parent="BasinRoom"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0382157, 4.21368, -0.0118849)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=37 format=4 uid="uid://bn4gslp2gk8ds"]
|
||||
[gd_scene load_steps=38 format=4 uid="uid://bn4gslp2gk8ds"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://fk3jis6rsipv" path="res://src/map/dungeon/code/corridor.gd" id="1_lepkf"]
|
||||
[ext_resource type="Texture2D" uid="uid://crsw35eypj6ry" path="res://src/map/dungeon/models/Set A/18. Corridor A/18_A1_CORRIDOR_A_WALL TILE 1.jpg" id="2_jmyyj"]
|
||||
@@ -496,6 +496,9 @@ _surfaces = [{
|
||||
blend_shape_mode = 0
|
||||
shadow_mesh = SubResource("ArrayMesh_p4f4g")
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_gbjb2"]
|
||||
size = Vector3(4.40063, 4, 1.67725)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_lepkf"]
|
||||
transparency = 1
|
||||
albedo_color = Color(1, 1, 1, 0)
|
||||
@@ -732,6 +735,14 @@ transform = Transform3D(-2, 0, 1.74846e-07, 0, 0.10779, 0, -1.74846e-07, 0, -2,
|
||||
mesh = SubResource("ArrayMesh_ux4sw")
|
||||
skeleton = NodePath("")
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="DOOR?_F_CUT"]
|
||||
collision_layer = 2147483648
|
||||
collision_mask = 2147483648
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="DOOR?_F_CUT/StaticBody3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0286865, 0, 0.463623)
|
||||
shape = SubResource("BoxShape3D_gbjb2")
|
||||
|
||||
[node name="DOOR?_R_CUT" type="CSGBox3D" parent="."]
|
||||
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -1.87415, -0.109414, -0.094615)
|
||||
use_collision = true
|
||||
@@ -743,6 +754,13 @@ transform = Transform3D(-8.74228e-08, 0, -2, 0, 0.10779, 0, 2, 0, -8.74228e-08,
|
||||
mesh = SubResource("ArrayMesh_tmqha")
|
||||
skeleton = NodePath("")
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="DOOR?_R_CUT"]
|
||||
collision_layer = 2147483648
|
||||
collision_mask = 2147483648
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="DOOR?_R_CUT/StaticBody3D"]
|
||||
shape = SubResource("BoxShape3D_gbjb2")
|
||||
|
||||
[node name="DOOR?_L_CUT" type="CSGBox3D" parent="."]
|
||||
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 1.98471, -0.0715388, -0.0946158)
|
||||
use_collision = true
|
||||
@@ -754,6 +772,13 @@ transform = Transform3D(-8.74228e-08, 0, -2, 0, 0.10779, 0, 2, 0, -8.74228e-08,
|
||||
mesh = SubResource("ArrayMesh_o04ue")
|
||||
skeleton = NodePath("")
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="DOOR?_L_CUT"]
|
||||
collision_layer = 2147483648
|
||||
collision_mask = 2147483648
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="DOOR?_L_CUT/StaticBody3D"]
|
||||
shape = SubResource("BoxShape3D_gbjb2")
|
||||
|
||||
[node name="DOOR?_B_CUT" type="CSGBox3D" parent="."]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -0.0339377, -0.127415, -2.00389)
|
||||
use_collision = true
|
||||
@@ -764,3 +789,10 @@ material = SubResource("StandardMaterial3D_4xu2u")
|
||||
transform = Transform3D(-2, 0, 1.74846e-07, 0, 0.10779, 0, -1.74846e-07, 0, -2, 0.00432197, 2.0282, -1.92743)
|
||||
mesh = SubResource("ArrayMesh_ue4n7")
|
||||
skeleton = NodePath("")
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="DOOR?_B_CUT"]
|
||||
collision_layer = 2147483648
|
||||
collision_mask = 2147483648
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="DOOR?_B_CUT/StaticBody3D"]
|
||||
shape = SubResource("BoxShape3D_gbjb2")
|
||||
|
||||
Reference in New Issue
Block a user