why is the trigger called 'select_button'

This commit is contained in:
Snorre 2025-04-05 04:31:12 +02:00
parent af3bcc5eca
commit 1068376829
2 changed files with 21 additions and 19 deletions

View file

@ -39,6 +39,6 @@ shape = SubResource("SphereShape3D_iyx0m")
[node name="XRCamera3D" type="XRCamera3D" parent="."]
[connection signal="button_pressed" from="LeftHand" to="." method="OnPress"]
[connection signal="input_float_changed" from="LeftHand" to="." method="OnFloat"]
[connection signal="profile_changed" from="LeftHand" to="LeftHand" method="OnProfileChanged"]
[connection signal="button_pressed" from="LeftHand" to="LeftHand" method="OnPress"]
[connection signal="button_released" from="LeftHand" to="LeftHand" method="OnRelease"]
[connection signal="input_float_changed" from="LeftHand" to="LeftHand" method="OnFloat"]

View file

@ -14,6 +14,16 @@ public partial class XRHand : XRController3D
public override void _Process(double delta)
{
if ((bool)GetInput("trigger_click"))
{
}
else if (joints.Count > 0)
{
}
}
public void OnPress(string name)
{
if (name == "select_button")
{
var query = new PhysicsShapeQueryParameters3D();
var sphere = new SphereShape3D();
@ -47,7 +57,11 @@ public partial class XRHand : XRController3D
AddChild(joint);
}
}
else if (joints.Count > 0)
}
public void OnRelease(string name)
{
if (name == "select_button")
{
foreach (var joint in joints)
joint.QueueFree();
@ -55,22 +69,10 @@ public partial class XRHand : XRController3D
}
}
public void OnProfileChange(string name)
{
GD.Print("Profile changed to:");
GD.Print(name);
}
public void OnPress(string name)
{
GD.Print("Button pressed:");
GD.Print(name);
}
public void OnFloat(string name, float value)
{
GD.Print("Float input:");
GD.Print(name);
GD.Print(value);
// GD.Print("Float input:");
// GD.Print(name);
// GD.Print(value);
}
}