Fix attachedHandle when attaching from the Editor

This commit is contained in:
Pascal Serrarens 2025-09-01 11:36:19 +02:00
parent 5c6b226b64
commit a0d2a00a3a
2 changed files with 7 additions and 4 deletions

View File

@ -76,6 +76,8 @@ namespace Passer.Humanoid {
}
protected virtual void AttachPrefab(Socket socket, SerializedProperty attachedTransformProp, GameObject prefab) {
SerializedProperty attachedHandleProp = serializedObject.FindProperty("attachedHandle");
if (attachedTransformProp.objectReferenceValue != null)
ReleaseObject(socket, attachedTransformProp);
@ -87,6 +89,7 @@ namespace Passer.Humanoid {
Debug.LogWarning("Could not attach transform");
else {
attachedTransformProp.objectReferenceValue = obj;
attachedHandleProp.objectReferenceValue = socket.attachedHandle;
//Handle handle = socket.attachedHandle;
//if (handle == null)
// Handle.Create(obj, socket);

View File

@ -580,10 +580,10 @@ namespace Passer.Humanoid {
AdvancedHandPhysics.SetNonKinematic(handRigidbody, colliders);
}
//if (handle.socket != null) {
// Debug.Log("Grab from socket");
// handle.socket.Release();
//}
if (handle.socket != null) {
Debug.Log("Grab from socket");
handle.socket.Release();
}
targetToHandle = hand.target.transform.InverseTransformPoint(grabSocket.transform.position);