- Home /
How to implement Mob movement / death ?
I'm trying to make a Diablo style game, and i'm wondering on how to set up my mobs. I got models with bones and animations (walking, idle, hit, etc) and i want to know the best way to make it work nice.
1) How do the big studios implement the movement?i guess they use some kind of animation or they only use ragdolls on which they add forces?(this sounds a bid hard to do on a large scale game)
2)i was initially using Character Controllers on mobs but i read its mostly for player - i guess it's true?I was moving models using transform.rotate and charactercontroller.move
3)So the right way to do it is to add a ragdoll, make the rigidbodies 'isKinematic' and when i want to add a force i enable one or some of them?
!!Using force would be nice when the mob dies (so that death effect is realistic), when a mob is being hit(i can make a 'being hit' animation, but i guess forces would make it look cooler), and when a mob is being pushed(if a mob bumps on another).
4)i've also read about death effect being implemented with killing initial object and instanciating a ragdoll on its place - wont that be bad looking since ragdoll pose when it is instanciated will be different that mob's before it is destroyed?
5) when i apply a ragdoll on my mobs, even if i turn it to 'isKinematic', animation turns sloppy, and that is caused by the box/shpere/cylinder colliders applied because if i destroy them animation is fine again - what can i do about this??
6)I see that oncollision() similar functions detect ground collisions that i dont need atm - is there a way to exclude them or should i just compare collision layer/tag with ground's?
Answer by The-Arc-Games · Oct 11, 2011 at 09:28 AM
The first three questions are too much game design-wise to be answered easily. Implementing full ragdoll character movement is a time consuming and complex art, so you normally just use animations, translations and rotations (this is actually what most game studios do), especially since it looks very good when done decently.
Regarding 4, 5 and 6:
4- you solve this by instantiating the ragdoll in the current object's pose, and then destroying the ragdoll (see below)
5- this is most certainly because of unwanted intersections between the colliders. can be solved by hand if you're very patient
6- using layers to leave out unwanted collisions is the best and fastest way to go. Just go to the physics options in unity's configuration and correctly set the collision matrix.
In particular, if you want to see how the pose copy script works, you have a working example in our ragdoll tool, the URG! http://unity.thearcgames.com/URG!_Ultimate_Ragdoll_Generator
Drop by the forum thread if you have questions about it, of if you found it useful :) http://forum.unity3d.com/threads/107501-Release-URG!-The-ultimate-ragdoll-generator