- Home /
How to setup character Collisions?
Hello!
I'm trying to setup my character and so far i modelled it, rigged it, animated it and imported it into Unity so now all i need to do is setup collisions and physics so i can start the actual game.
But my question is, how can i do this?
Obviously, i expect my character to be affected by physics in many occasions, like fly away when it's nearby an explosion or turn into a ragdoll when it falls/dies. I tried to find a good way to get these results and i found alot of articles about the character controller, rigidbodies and colliders, but i ended up confused and without an idea of which one i should use. I'm not sure if this changes anything, but i'll be using mecanim.
Extra info:
I've been reading some stuff about character control and it doesn't seem like the best approach for me, since i want to have full controll over my character and know exactly how it behaves. Also programming is not a problem to me so i would like to script something that could help me, all i need is some help to find the best way of doing it.
Thanks in advance!
This is just a thought but maybe you can instantiate a ragdoll prefab in the characters position when it dies and just delete the character itself and maybe have a camera setup with the ragdoll.
Could i go back to animation smoothly? And what about the actual character physics, collider, rigidbody or character controller?
Character controller or custom for character movement with respect to collision. Custom solution won't be easy, but you might avoid the quirks of Character Controller.
Rigid body ragdoll setup disabled. Script that disable/enables ragdoll when needed. (Turns off kinematics?) I don't think you should instantiate/destroy anything that large at runtime, so I'd have it already in the player and ready to toggle.
If returning from ragdoll, give your animation a longer tween time. But honestly, returning to animation from ragdoll is difficult. Ideally you want your ragdoll heavily constrained so it can't get in any weird broken positions. (Diablo3 made some vast improvements to ragdoll physics. I saw a behind the scenes on it. Check it out, it may be useful.)
That's what I'd do at least... Hope this helped!
I'm still super confused about all this, but i think i'll try to make a custom rigid body character controller, i'll try to find some info about it.
Answer by RetepTrun · Dec 16, 2013 at 01:59 PM
A ragdoll is a dead body.
To me there are 2 approaches to dieing.
Doing a swap which is imperceptable to player
Dead body walking but kinematic.
My process.
make capsule gameobject with rigidbody constrained not to tip over
script to add forces to slide it around for character motion (very tricky to adjust till acceptable to self)
add mouse look script to turn it horizontally
use ragdoll wizard on character
choose to become ragdoll - by replacing with ragdoll (impossible to get up again after death but easier to implement), Or -using ragdoll with all rigidbodies set to kinematic as character then setting to unkinematic on death ().
I'll try use your process because i want something simple that works and it looks like it's a simple process.
Answer by Kavorka · Feb 02, 2014 at 05:27 PM
I quess this AnimFollow
is quite exactly what you are looking for.