re-added xrhand to right hand

This commit is contained in:
Snorre 2025-04-05 18:49:06 +02:00
parent ffeaf1aaa8
commit c351ec7f4a
2 changed files with 10 additions and 9 deletions

View file

@ -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"]

View file

@ -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)