This commit is contained in:
Snorre 2025-04-05 19:02:13 +02:00
parent 13106ad8b2
commit b4b989f5f7

View file

@ -3,7 +3,7 @@ using System.Collections.Generic;
public partial class XRHand : XRController3D
{
List<Generic6DofJoint3D> joints = new();
List<PinJoint3D> joints = new();
[Export]
RigidBody3D rb;
@ -51,15 +51,19 @@ public partial class XRHand : XRController3D
GD.Print("Picked up ", body);
Generic6DofJoint3D joint = new();
PinJoint3D joint = new();
joint.NodeA = body.GetPath();
joint.NodeB = rb.GetPath();
joints.Add(joint);
rb.AddChild(joint);
joint.Position = Vector3.Zero;
joint.SetParamX(Generic6DofJoint3D.Param.LinearLimitSoftness, 5f);
joint.SetParamY(Generic6DofJoint3D.Param.LinearLimitSoftness, 5f);
joint.SetParamZ(Generic6DofJoint3D.Param.LinearLimitSoftness, 5f);
PinJoint3D joint2 = new();
joint2.NodeB = body.GetPath();
joint2.NodeA = rb.GetPath();
joints.Add(joint);
body.AddChild(joint);
joint.Position = Vector3.Zero;
}
}
}