Fix attaching to moving sockets

This commit is contained in:
Pascal Serrarens 2025-08-19 09:30:18 +02:00
parent f177384da3
commit 200db545b9

View File

@ -504,6 +504,14 @@ namespace Passer {
joint.breakForce = float.PositiveInfinity;
joint.breakTorque = float.PositiveInfinity;
Rigidbody socketRigidbody = GetComponent<Rigidbody>();
if (socketRigidbody == null) {
socketRigidbody = this.gameObject.AddComponent<Rigidbody>();
socketRigidbody.isKinematic = true;
}
joint.connectedBody = socketRigidbody;
attachedTransform = objRigidbody.transform;
attachedHandle = handle;
handle.socket = this;
@ -765,7 +773,7 @@ namespace Passer {
}
}
#endregion Rigidbody
#endregion Rigidbody
#region Static Object
@ -811,7 +819,7 @@ namespace Passer {
#endregion Static Object
#endregion Release
#endregion Release
#region Start