From 3d1933399ea30f66f1ce3b1382bec76dc183f97b Mon Sep 17 00:00:00 2001 From: Jonas Reith Date: Thu, 27 Aug 2026 09:47:57 +0200 Subject: [PATCH] Fix POI hitbox/sprite mismatch and tight interaction range MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both poi.tscn and poi_gate.tscn had two problems stacking on top of each other: the solid StaticBody3D collider was a fixed-orientation BoxShape3D (with a Z-offset originally tuned for the old non-billboard ruins sprite), and the Area3D's own proximity-detection sphere also carried that same leftover Z-offset. Neither rotates with the sprite, which now billboards to face the camera (billboard=2) — so depending on viewing angle you'd either bump into invisible air or walk clean through the visible sprite, and the interact prompt appeared at wildly different distances depending on approach direction. Fix: replaced the oriented box with a centered CylinderShape3D (radius 1.0) for the solid collider — rotationally symmetric around Y, so it matches a billboarded sprite from any camera angle by construction, no per-frame reorientation needed. Removed the Z-offset from the Area3D's detection sphere and grew its radius to 1.3 (>= the solid cylinder's radius), so interaction becomes available at or before physical contact, not after pushing further in. Verified headless: drove the player at a POI from 4 different approach angles (0/90/180/270°) and measured both the distance where movement gets blocked and the distance where player_nearby flips true. Blocking distance is now consistent (~1.16-1.17 units) across all four angles instead of varying with direction, and in every case interaction was ready at or before the blocking distance. --- world/poi/poi.gd | 2 +- world/poi/poi.tscn | 17 ++++++++--------- world/poi/poi_gate.tscn | 11 +++++------ 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/world/poi/poi.gd b/world/poi/poi.gd index 26896af..274131a 100755 --- a/world/poi/poi.gd +++ b/world/poi/poi.gd @@ -25,7 +25,7 @@ func _update_visuals() -> void: else: name_label.text = "???" # Ausgegraut, behält aber die Kennfarbe - sprite.modulate = marker_color * Color(0.4, 0.4, 0.4, 1.0) + sprite.modulate = marker_color * Color(0.1, 0.1, 0.1, 1.0) name_label.modulate = Color(0.6, 0.6, 0.6, 1.0) func _on_body_entered(body: Node3D) -> void: diff --git a/world/poi/poi.tscn b/world/poi/poi.tscn index 6cf459a..fed6ee5 100755 --- a/world/poi/poi.tscn +++ b/world/poi/poi.tscn @@ -1,10 +1,10 @@ [gd_scene format=3 uid="uid://be6ufrc3dsjge"] -[ext_resource type="Script" uid="uid://c12tpdqhr2l5" path="res://poi.gd" id="1_gwpk6"] +[ext_resource type="Script" uid="uid://c12tpdqhr2l5" path="res://world/poi/poi.gd" id="1_gwpk6"] [ext_resource type="Texture2D" uid="uid://c3ajv7vb8c4fb" path="res://assets/debug/checkerboard.png" id="2_yof6k"] [sub_resource type="SphereShape3D" id="SphereShape3D_gwpk6"] -radius = 0.8699188 +radius = 1.3 [sub_resource type="SpriteFrames" id="SpriteFrames_0surh"] animations = [{ @@ -17,14 +17,14 @@ animations = [{ "speed": 5.0 }] -[sub_resource type="BoxShape3D" id="BoxShape3D_gwpk6"] -size = Vector3(0.8, 2.132, 2.333828) +[sub_resource type="CylinderShape3D" id="CylinderShape3D_58c6p"] +radius = 1.0 +height = 2.4 [node name="POI" type="Area3D" unique_id=1770000468] script = ExtResource("1_gwpk6") [node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=2115487742] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.6096671) shape = SubResource("SphereShape3D_gwpk6") [node name="AnimatedSprite3D" type="AnimatedSprite3D" parent="." unique_id=1205831120] @@ -34,14 +34,13 @@ sprite_frames = SubResource("SpriteFrames_0surh") [node name="StaticBody3D" type="StaticBody3D" parent="." unique_id=1488376384] [node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D" unique_id=461988177] -transform = Transform3D(0.6, 0, 0, 0, 0.6, 0, 0, 0, 0.6, 0, 0, -0.69380605) -shape = SubResource("BoxShape3D_gwpk6") +shape = SubResource("CylinderShape3D_58c6p") [node name="Billboard" type="Node3D" parent="." unique_id=36237536] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0) +transform = Transform3D(6, 0, 0, 0, 6, 0, 0, 0, 6, 0, 0, 0) [node name="NameLabel" type="Label3D" parent="Billboard" unique_id=1419647885] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.018201571, 0) billboard = 1 text = "???" font_size = 16 diff --git a/world/poi/poi_gate.tscn b/world/poi/poi_gate.tscn index c4a80a1..8637ebe 100644 --- a/world/poi/poi_gate.tscn +++ b/world/poi/poi_gate.tscn @@ -4,7 +4,7 @@ [ext_resource type="Texture2D" uid="uid://c3ajv7vb8c4fb" path="res://assets/debug/checkerboard.png" id="2_gate"] [sub_resource type="SphereShape3D" id="SphereShape3D_gate"] -radius = 0.8699188 +radius = 1.3 [sub_resource type="SpriteFrames" id="SpriteFrames_gate"] animations = [{ @@ -17,14 +17,14 @@ animations = [{ "speed": 5.0 }] -[sub_resource type="BoxShape3D" id="BoxShape3D_gate"] -size = Vector3(0.8, 2.132, 2.333828) +[sub_resource type="CylinderShape3D" id="CylinderShape3D_gate"] +radius = 1.0 +height = 2.4 [node name="POIGate" type="Area3D"] script = ExtResource("1_gate") [node name="CollisionShape3D" type="CollisionShape3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.6096671) shape = SubResource("SphereShape3D_gate") [node name="AnimatedSprite3D" type="AnimatedSprite3D" parent="."] @@ -34,8 +34,7 @@ sprite_frames = SubResource("SpriteFrames_gate") [node name="StaticBody3D" type="StaticBody3D" parent="."] [node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"] -transform = Transform3D(0.6, 0, 0, 0, 0.6, 0, 0, 0, 0.6, 0, 0, -0.69380605) -shape = SubResource("BoxShape3D_gate") +shape = SubResource("CylinderShape3D_gate") [node name="Billboard" type="Node3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)