From c351ec7f4a789d261e490014dd3f3449c6e3f782 Mon Sep 17 00:00:00 2001 From: Snorre Date: Sat, 5 Apr 2025 18:49:06 +0200 Subject: [PATCH] re-added xrhand to right hand --- resources/player.tscn | 9 ++++----- scripts/XRHand.cs | 10 ++++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/resources/player.tscn b/resources/player.tscn index 1e53089..82764e1 100644 --- a/resources/player.tscn +++ b/resources/player.tscn @@ -1,7 +1,6 @@ -[gd_scene load_steps=8 format=3 uid="uid://8fmy7u5fyonc"] +[gd_scene load_steps=7 format=3 uid="uid://8fmy7u5fyonc"] [ext_resource type="Script" uid="uid://bf27rxigs8b22" path="res://scripts/XRHand.cs" id="1_gyc3h"] -[ext_resource type="Script" uid="uid://cjuwcdex32ad0" path="res://scripts/GrabTester.cs" id="3_graai"] [ext_resource type="Script" uid="uid://typrll7n6g3e" path="res://scripts/Mouth.cs" id="3_un1ji"] [sub_resource type="CapsuleMesh" id="CapsuleMesh_ij1v8"] @@ -42,9 +41,11 @@ disabled = true [node name="CollisionShape3D" type="CollisionShape3D" parent="LeftHand/Area3D"] shape = SubResource("SphereShape3D_un1ji") -[node name="RightHand" type="XRController3D" parent="."] +[node name="RightHand" type="XRController3D" parent="." node_paths=PackedStringArray("rb")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.412168, 0.292391, 0) tracker = &"right_hand" +script = ExtResource("1_gyc3h") +rb = NodePath("RigidBody3D") [node name="MeshInstance3D" type="MeshInstance3D" parent="RightHand"] mesh = SubResource("CapsuleMesh_ij1v8") @@ -52,7 +53,6 @@ mesh = SubResource("CapsuleMesh_ij1v8") [node name="RigidBody3D" type="RigidBody3D" parent="RightHand"] freeze = true freeze_mode = 1 -script = ExtResource("3_graai") [node name="CollisionShape3D" type="CollisionShape3D" parent="RightHand/RigidBody3D"] shape = SubResource("SphereShape3D_iyx0m") @@ -84,6 +84,5 @@ shape = SubResource("SphereShape3D_ucfva") [connection signal="button_pressed" from="RightHand" to="RightHand" method="OnPress"] [connection signal="button_released" from="RightHand" to="RightHand" method="OnRelease"] [connection signal="input_float_changed" from="RightHand" to="RightHand" method="OnFloat"] -[connection signal="SpamGrab" from="RightHand/RigidBody3D" to="RightHand" method="OnPress"] [connection signal="body_entered" from="RightHand/Area3D" to="RightHand" method="OnEnter"] [connection signal="body_exited" from="RightHand/Area3D" to="RightHand" method="OnLeave"] diff --git a/scripts/XRHand.cs b/scripts/XRHand.cs index 76695bf..951527c 100644 --- a/scripts/XRHand.cs +++ b/scripts/XRHand.cs @@ -13,9 +13,10 @@ public partial class XRHand : XRController3D [Export] public float Strength = 1.0f; - public override void _Ready() { - if (rb == null) - GD.PrintErr("Missing Rigidbody"); + public override void _Ready() + { + if (rb == null) + GD.PrintErr("Missing Rigidbody"); } public void OnEnter(Node3D node) @@ -40,6 +41,7 @@ public partial class XRHand : XRController3D public void OnPress(string name) { + GD.Print("Pressed Input ", name); if (name == "select_button") { foreach (RigidBody3D body in overlaps) @@ -61,7 +63,7 @@ public partial class XRHand : XRController3D public void OnRelease(string name) { - GD.Print("lego"); + GD.Print("Released Input ", name); if (name == "select_button") { foreach (var joint in joints)