From c9edb73c5052bab0e3c8cddce5ae2652115f82ff Mon Sep 17 00:00:00 2001 From: EvanGee Date: Sat, 1 Jun 2024 12:06:02 -0600 Subject: [PATCH] add ground collider --- level/Ground.gd | 2 ++ level/level.tscn | 54 +++++++++++++++++++++++++----------------------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/level/Ground.gd b/level/Ground.gd index 4533590..c807d56 100644 --- a/level/Ground.gd +++ b/level/Ground.gd @@ -2,3 +2,5 @@ extends StaticBody3D func grounded(src: Player): src._is_grounded = true + + diff --git a/level/level.tscn b/level/level.tscn index 0b01d8d..c35706e 100644 --- a/level/level.tscn +++ b/level/level.tscn @@ -1,23 +1,27 @@ -[gd_scene load_steps=11 format=3 uid="uid://b00brfkibo5cj"] +[gd_scene load_steps=14 format=3 uid="uid://b00brfkibo5cj"] [ext_resource type="PackedScene" uid="uid://bq654gwim6col" path="res://level/level.glb" id="1_s37in"] [ext_resource type="Environment" uid="uid://covjrwmk4rplw" path="res://level/world_environment.tres" id="2_ptkl6"] [ext_resource type="Script" path="res://level/level.gd" id="2_s1bx6"] +[ext_resource type="Script" path="res://level/StaticBody3D.gd" id="4_6rwm2"] [ext_resource type="Script" path="res://addons/smoother/smoother.gd" id="5_2tyle"] [ext_resource type="Script" path="res://level/PlayerSpawner.gd" id="6_7ww0m"] [ext_resource type="MeshLibrary" uid="uid://cgh6y5j8wgi36" path="res://level/mesh_library/level_mesh_library.glb" id="6_d34iv"] -[ext_resource type="Script" path="res://level/Ground.gd" id="7_81ape"] +[ext_resource type="Script" path="res://level/Ground.gd" id="8_fuivp"] + +[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_ujmev"] +margin = 2.067 + +[sub_resource type="BoxShape3D" id="BoxShape3D_qp06x"] +size = Vector3(2, 0.1, 2) [sub_resource type="QuadMesh" id="QuadMesh_8lqeb"] size = Vector2(100, 100) [sub_resource type="BoxShape3D" id="BoxShape3D_m3lo5"] -size = Vector3(100, 100, 1) -[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_285vp"] -properties/0/path = NodePath("SharedUI/SharedMessage:text") -properties/0/spawn = true -properties/0/replication_mode = 1 +[sub_resource type="BoxShape3D" id="BoxShape3D_kefm0"] +size = Vector3(6.87, 1, 1) [node name="level" instance=ExtResource("1_s37in")] script = ExtResource("2_s1bx6") @@ -32,6 +36,17 @@ transform = Transform3D(1, 0, 0, 0, 0.566018, 0.824393, 0, -0.824393, 0.566018, transform = Transform3D(25.5862, 0, 0, 0, 25.5862, 0, 0, 0, 25.5862, 0.00464344, 0, 0.0305362) visible = false +[node name="StaticBody3D" type="StaticBody3D" parent="Plane" index="0" groups=["ground"]] +script = ExtResource("4_6rwm2") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Plane/StaticBody3D" index="0"] +transform = Transform3D(0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1, 0, 0, 0) +shape = SubResource("WorldBoundaryShape3D_ujmev") + +[node name="CollisionShape3D2" type="CollisionShape3D" parent="Plane/StaticBody3D" index="1"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.05, 0) +shape = SubResource("BoxShape3D_qp06x") + [node name="Cube" parent="." index="2"] visible = false @@ -73,27 +88,14 @@ mesh = SubResource("QuadMesh_8lqeb") skeleton = NodePath("../Cube") [node name="StaticBody3D" type="StaticBody3D" parent="MeshInstance3D" index="0"] -script = ExtResource("7_81ape") [node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D/StaticBody3D" index="0"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.5) +transform = Transform3D(100, 0, 0, 0, 100, 0, 0, 0, 1, 0, 0, -0.5) shape = SubResource("BoxShape3D_m3lo5") -[node name="SharedUI" type="Control" parent="." index="9"] -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 +[node name="StaticBody3D" type="StaticBody3D" parent="." index="9"] -[node name="GlobalMessage" type="Label" parent="SharedUI" index="0"] -unique_name_in_owner = true -layout_mode = 2 -offset_right = 1152.0 -offset_bottom = 23.0 -text = "Waiting for at least 2 players to join" -horizontal_alignment = 1 - -[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="." index="10"] -replication_config = SubResource("SceneReplicationConfig_285vp") +[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D" index="0"] +transform = Transform3D(1.5, 0, 0, 0, 3.2, 0, 0, 0, 10, 5.01694, 11.1202, -5.176) +shape = SubResource("BoxShape3D_kefm0") +script = ExtResource("8_fuivp")