Quantcast
Channel: Questions in topic: "ragdoll"
Viewing all articles
Browse latest Browse all 565

How do you set the positions of a ragdoll to that of bones in the last frame of played animation?

$
0
0
Hello, I have encountered a problem with my ragdolls in unity. The way I am doing ragdolls is prefabbing them and instantiated them when the main game object is killed. They instantiate just fine but I am having trouble setting the positions of the bones to that of the animation at time of death. Here is what I am doing: ---------- GameObject ragdoll = Instantiate(m_ragdoll, transform.position, transform.rotation) as GameObject; Utilities.ConfigureRagdollPosition(transform, ragdoll.transform); ---------- ConfigureRagdollPosition(): ---------- public static void ConfigureRagdollPosition(Transform reference, Transform ragdollPart) { ragdollPart.localPosition = reference.localPosition; ragdollPart.localRotation = reference.localRotation; for (int i = 0; i < reference.childCount; i++) { Transform ref_t = reference.GetChild(i); Transform rag_t = reference.GetChild(i); if(ref_t != null && rag_t != null) ConfigureRagdollPosition(ref_t, rag_t); } } ---------- The ragdoll just starts up in the T pose, because I'm assuming that animations don't work the way I thought they did (i.e. moving the game objects with the bones). What is the correct way of doing this? Additional Info: I am currently working with the unity construction worker model and animations for this. Debug.Log shows that it is iterating through the children recursively.

Viewing all articles
Browse latest Browse all 565

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>