diff --git a/resources/player.tscn b/resources/player.tscn index 872e4be..4ebcab5 100644 --- a/resources/player.tscn +++ b/resources/player.tscn @@ -18,10 +18,11 @@ radius = 0.03 current = true script = ExtResource("1_ucfva") -[node name="LeftHand" type="XRController3D" parent="."] +[node name="LeftHand" type="XRController3D" parent="." node_paths=PackedStringArray("body")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.381652, 0.302346, 0) tracker = &"left_hand" script = ExtResource("1_gyc3h") +body = NodePath("RigidBody3D") [node name="MeshInstance3D" type="MeshInstance3D" parent="LeftHand"] mesh = SubResource("CapsuleMesh_ij1v8") @@ -33,10 +34,11 @@ freeze_mode = 1 [node name="CollisionShape3D" type="CollisionShape3D" parent="LeftHand/RigidBody3D"] shape = SubResource("SphereShape3D_iyx0m") -[node name="RightHand" type="XRController3D" parent="."] +[node name="RightHand" type="XRController3D" parent="." node_paths=PackedStringArray("body")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.412168, 0.292391, 0) tracker = &"right_hand" script = ExtResource("1_gyc3h") +body = NodePath("RigidBody3D") [node name="MeshInstance3D" type="MeshInstance3D" parent="RightHand"] mesh = SubResource("CapsuleMesh_ij1v8") diff --git a/scripts/XRHand.cs b/scripts/XRHand.cs index 92a511b..81545df 100644 --- a/scripts/XRHand.cs +++ b/scripts/XRHand.cs @@ -6,7 +6,7 @@ public partial class XRHand : XRController3D List joints = new(); [Export] - StaticBody3D body; + RigidBody3D body; [Export] public float Strength = 1.0f; @@ -44,7 +44,7 @@ public partial class XRHand : XRController3D Generic6DofJoint3D joint = new(); joint.NodeA = body.GetPath(); - joint.NodeB = GetPath(); + joint.NodeB = this.body.GetPath(); joints.Add(joint); AddChild(joint);