Hi all, At current I've setup an enemy using the soldier from the bootcamp demo that just casually walks around. When I shoot at it and his "health" equals zero the model is replaced with a ragdoll prefab that I created. The only problem is when the ragdoll is instantiated it is in the "T" position. How can I make the ragdoll into the position that the soldier is standing when the character gets replaced with the ragdoll? Hope everyone understands what I'm trying to get across Thanks in advance. Jack
Hello there! You'll have to go through each joint and position it correctly. Code (csharp): Transform[] ragdollJoints = ragdoll.GetComponentsInChildren<Transform>(); Transform[] currentJoints = solider.GetComponentsInChildren<Transform>(); for(int i = 0; i < ragdollJoints.Length; i++) { for(int q = 0; q < currentJoints.Length; q++) { if(currentJoints[q].name.ComperaTo(ragdollJoint[i].name) == 0) { ragdollJoint[i].position = currentJoints[q].position; ragdollJoint[i].rotation = currentJoints[q].rotation; break; } } } This code should gather all joints, then go through each joint in the ragdoll and search for joint in the current model with the same name. If the same name is found, the ragdoll's joint is positioned like it. Note that this code is written in browser, so I can't guarantee it will work from scratch. There's more optimized ways to do this, but this should give you a general idea of what needs to be done.
You don't need to seperate objects (Solider Model and Ragdoll). You can make both in one model, just disable the ragdoll colliders and mark then kinematic when your player is moving. When he dies, disable the normal collider box (of the player/solider model) and enable the ragdoll colliders and put then non-kinematic and it will colapse in it's current position
I modified the code a little bit and it worked for me: Transform[] ragdollJoints = ragdoll.GetComponentsInChildren<Transform>(); Transform[] currentJoints = transform.GetComponentsInChildren<Transform>(); for(int i = 0; i < ragdollJoints.Length; i++){ for(int q = 0; q < currentJoints.Length; q++) { if(currentJoints[q].name.CompareTo(ragdollJoints.name) == 0){ ragdollJoints.position = currentJoints[q].position; ragdollJoints.rotation = currentJoints[q].rotation; break; } } } For me, this is all running on a health script attached to the player. If you did something different, you would have to change the line "Transform[] currentJoints = transform.GetComponentsInChildren<Transform>();" to "Transform[] currentJoints = soldier.GetComponentsInChildren<Transform>();"