master
selim 2026-01-12 19:05:16 +01:00
parent adeb8fa272
commit 22112e11c7
6 changed files with 164 additions and 97 deletions

37
DoorLock.gd 100644
View File

@ -0,0 +1,37 @@
extends Node3D
# Referenz zur Tür (der RigidBody)
@export var door_rigidbody : RigidBody3D
# Referenz zur SnapZone (der "WheelSpace")
@export var wheel_snap_zone : XRToolsSnapZone
func _ready():
# Wir verbinden das Signal der SnapZone
if wheel_snap_zone:
# "has_picked_up" wird gefeuert, wenn die Zone ein Objekt fängt
wheel_snap_zone.has_picked_up.connect(_on_wheel_inserted)
# Optional: Wenn man das Rad wieder rausnimmt, soll die Tür wieder zu gehen?
# Dann aktiviere die nächste Zeile:
# wheel_snap_zone.has_dropped.connect(_on_wheel_removed)
# Sicherstellen, dass die Tür am Start zu ist
lock_door()
func _on_wheel_inserted(_object):
print("Rad eingesetzt! Tür wird entriegelt.")
unlock_door()
func _on_wheel_removed(_object):
print("Rad entfernt! Tür wird verriegelt.")
lock_door()
func unlock_door():
if door_rigidbody:
door_rigidbody.freeze = false # Physik an -> Tür beweglich
# Optional: Schlafeinschlafen verhindern
func lock_door():
if door_rigidbody:
door_rigidbody.freeze = true # Physik aus -> Tür fest wie eine Wand

1
DoorLock.gd.uid 100644
View File

@ -0,0 +1 @@
uid://bynhdxidxy23t

View File

@ -0,0 +1,13 @@
[gd_scene load_steps=3 format=3 uid="uid://bckvyatytdncj"]
[ext_resource type="PackedScene" uid="uid://c8l60rnugru40" path="res://addons/godot-xr-tools/objects/pickable.tscn" id="1_mpmja"]
[sub_resource type="BoxShape3D" id="BoxShape3D_kaqxa"]
size = Vector3(0.2, 0.2, 0.2)
[node name="DoorHandle" instance=ExtResource("1_mpmja")]
[node name="CollisionShape3D" parent="." index="0"]
shape = SubResource("BoxShape3D_kaqxa")
[node name="MeshInstance3D" type="MeshInstance3D" parent="." index="1"]

View File

@ -2,14 +2,14 @@
[ext_resource type="PackedScene" uid="uid://c31oleh3x06ku" path="res://addons/godot-xr-tools/objects/wheel_snap_zone.tscn" id="1_ttqdy"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_0jfqd"]
albedo_color = Color(2.2862106e-07, 0.29880682, 0.29880682, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ttqdy"]
albedo_color = Color(1.0829419e-06, 0.3589771, 0.3589772, 1)
albedo_color = Color(0.54901963, 0.58431375, 0.59607846, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_qy0yp"]
albedo_color = Color(0, 0.29803923, 0.29803923, 1)
albedo_color = Color(0.54901963, 0.58431375, 0.59607846, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_v36v7"]
albedo_color = Color(0.54901963, 0.58431375, 0.59607846, 1)
[node name="WheelSpace" type="Node3D"]
@ -18,7 +18,7 @@ transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 0, 0
[node name="CSGBox3D" type="CSGBox3D" parent="CSGCombiner3D"]
size = Vector3(0.35, 0.35, 0.15)
material = SubResource("StandardMaterial3D_0jfqd")
material = SubResource("StandardMaterial3D_ttqdy")
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="CSGCombiner3D"]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, -1, 0, 1, -4.371139e-08, 0, 0, 0.059342176)
@ -26,14 +26,14 @@ operation = 2
radius = 0.105
height = 0.035
sides = 60
material = SubResource("StandardMaterial3D_ttqdy")
material = SubResource("StandardMaterial3D_qy0yp")
[node name="CSGCylinder3D2" type="CSGCylinder3D" parent="CSGCombiner3D"]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, -1, 0, 1, -4.371139e-08, 0, 0, 0.0604029)
radius = 0.012
height = 0.035
sides = 60
material = SubResource("StandardMaterial3D_qy0yp")
material = SubResource("StandardMaterial3D_v36v7")
[node name="WheelSnapZone" parent="." instance=ExtResource("1_ttqdy")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.10869917, 0, 0)

File diff suppressed because one or more lines are too long

View File

@ -44,4 +44,4 @@ transform = Transform3D(0.00025759128, -0.0019833425, 0, 0.0018915471, 0.0002456
[node name="PlayerBody" parent="." instance=ExtResource("4_2hs0m")]
player_height_rate = 20.0
push_strength_factor = 5.0
head_behavior_mode = 2