I’ve got a character (a rigged 3ds max model) who runs around and jumps onto a snowboard, which you can then control through jumps etc. Its currently hooked up using a character controller and faked gravity.
I’m looking to make it so if the character stacks it off a jump, the character turns into a ragdoll and lets physics take its course. I can’t seem to find any tutorials about it, but I’m lead to believe that I need to attach Rigidbodys, Character Joints and Colliders to each of my bipeds bones (L Thigh, L Calf etc). And then set isKinematic to true for each.
Then when a crash occurs, I run through each of these rigidbodys in my script and set isKinematic to false, to allow gravity to run its course. Is this correct? Also is likely to have a large performance hit on my scene?
That’s correct. Attach a character joint, rigidbody and a collider to each join you want to move when your character is ragdolled. Don’t forget to edit each character join to point at a parent rigidbody.
isKinematic should prevent the ragdoll from being active while it’s on but I personally would prefer swapping a controllable character object with a ragdoll object upon crash instead. It’s a much more cleaner approach.
Also, ragdolls shouldn’t affect your performance much unless you’re going to have more 25+ of them.
Ok cool glad to see I’m on the right track with this. In terms of your technique to swap out the character object to a ragdoll object at the point of the crash, do you mean I literally have another copy of my player, with zero visibility or something that I then enable/show at the point of contact? Or is it best to dynamically add him from the library at the point of contact? I understand what you mean but I don’t know the best way to do it hehe.
Ok I’ve got this all working quite nicely now, the model switches and the ragdoll is thrown onto the floor.
However, maybe 1 in 4 times that I switch to the ragdoll, he falls straight through the floor. Surely it can’t be “spawning” him below ground as I’m setting the ragdolls transform to exactly that of the initial character. Could this be to do with the fact my terrain is a 3ds model?
Also occasionally I’m getting some very strange bouncing (like sometimes the ragdoll bounces so high he goes off screen), but I can’t see any settings anywhere to change surface restitution or anything…