move joints before rigidbodies

This commit is contained in:
mischa 2024-01-24 15:53:30 +01:00
parent 5fab4c7978
commit 7b4a094f5c

View File

@ -368,9 +368,11 @@ public static void MoveAllJoints(GameObject source, GameObject destination)
// move all physics components from one GameObject to another.
public static void MovePhysicsComponents(GameObject source, GameObject destination)
{
MoveRigidbody(source, destination);
MoveAllColliders(source, destination);
// need to move joints first, otherwise we might see:
// 'can't move Rigidbody because a Joint depends on it'
MoveAllJoints(source, destination);
MoveAllColliders(source, destination);
MoveRigidbody(source, destination);
}
}
}