From 4b21780f6d8bee934a04610b6617fa6d1909f1c9 Mon Sep 17 00:00:00 2001 From: Jonas Reith Date: Wed, 26 Aug 2026 19:58:28 +0200 Subject: [PATCH] Fix player falling through terrain MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Player gets its own CapsuleShape3D (was a small CylinderShape3D, never actually shared with anything — the shared oversized capsule flagged earlier only affects the 4 mountain props, unrelated to the player). Real cause of the fall-through: the crown collision is a zero-thickness trimesh and the player spawned with exactly zero clearance sitting right on the surface, a classic tunneling setup. Fixed by giving the trimesh backface_collision (collide from both sides) and spawning the player with a bit of headroom so it settles onto the floor instead of starting embedded in it. Verified headless: player now falls from spawn height to rest exactly on the surface and stays on_floor=true over a 3s simulated run. --- main.tscn | 8 ++++---- terrain.gd | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/main.tscn b/main.tscn index 4adcdc5..6cc880f 100755 --- a/main.tscn +++ b/main.tscn @@ -13,9 +13,9 @@ ambient_light_color = Color(0, 0, 0.31764707, 1) ambient_light_energy = 0.3 -[sub_resource type="CylinderShape3D" id="CylinderShape3D_7mycd"] -height = 0.5 +[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_player"] radius = 0.16 +height = 0.5 [sub_resource type="AtlasTexture" id="AtlasTexture_lquwl"] atlas = ExtResource("2_h2yge") @@ -177,11 +177,11 @@ environment = SubResource("Environment_h2yge") script = ExtResource("1_terrain") [node name="Player" type="CharacterBody3D" parent="." unique_id=1504574304 groups=["player"]] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.25, 0) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0) script = ExtResource("1_0xm2m") [node name="CollisionShape3D" type="CollisionShape3D" parent="Player" unique_id=1483851051] -shape = SubResource("CylinderShape3D_7mycd") +shape = SubResource("CapsuleShape3D_player") [node name="AnimatedSprite3D" type="AnimatedSprite3D" parent="Player" unique_id=155581900] billboard = 2 diff --git a/terrain.gd b/terrain.gd index 145f79f..08f869d 100644 --- a/terrain.gd +++ b/terrain.gd @@ -84,7 +84,9 @@ func _build_crown() -> void: mi.mesh = mesh body.add_child(mi) var cs := CollisionShape3D.new() - cs.shape = mesh.create_trimesh_shape() + var trimesh := mesh.create_trimesh_shape() + trimesh.backface_collision = true # dünnes Mesh: von beiden Seiten kollidieren, kein Durchfallen + cs.shape = trimesh body.add_child(cs) add_child(body)