This is the first dinosaur I worked on: Rajasaurus.
The characters in the game usually move via Animation or Ragdoll Physics. We decided to go with physics simulation by setting up the dinosaurs as Ragdoll.
The most tricky part to make the dinosaur walk, was to setup the physics : setup the weight of the rigidbodies, the values on the character joints, as it differes from dinosaur to dinosaur.
One such example is of Carnotaurus:
So when I started working on this dinosaur, I incurred many problems. I learnt a lot while working on this dinosaur.
There are two ways to make this dinosaur walk. 1. Player input 2. it walks on its own.
After hooking up the joints, colliders, hinge and character joints, I set this dinosaur to walk on its own. The dinosaur could stand properly, but the moment it started to move its legs, the mesh exploded. There could be many reasons to that:
1. Weights on the rigidbody: adjusted the weights on the rigidbodies on each bone, so it doesnt wiegh down the mesh.
2. Size and position of the colliders: if the colliders are not in proper position and if the size is not right, it can cause the mesh to explode. For eg, if two colliders collide and one of them moves beyond a certain point, the mesh can explode too.
After trying these two solutions, the dinosaur tried to reset itself to its original position like you see in the gif, and it starts walking again. So, some different solutions were needed.
3. Constraints on the joints (rigidbody): Keeping constraints on the rigidbody restricts its movements in that direction either by position or by rotation. In that way, one can restrict the movement of the joint in a particular direction, and hence the mesh. But keeping too many constraints on the joints and restricting its movement can also cause the mesh to explode, as the joint might be constantly trying to move in that direction.
4. Rotation limits on the hinge joints: Setting the limits on the hinge joints, helps us move the joint by only a certain. It is helpful to make sure the hinge joints do not swing alot.
5. Rigging/skinning issues in maya: If the mesh is not skinned properly, and there are joints affecting different parts of the mesh, it can cause issues in ragdoll physics simulation. After trying above all the solutions and after some discussions, we thought of fixing the weights in maya. After fixing the weights, we brought the dinosaur back to unity, applied all the previous changes, it worked perfectly fine.
In Unity, it is easier to detect the collision between the colliders and find out which one is causing the other to move alot and fix that. Skinning issues in unity is usually detected by mere observation of how the mesh is moving.
So, the dinosaur finally walked like this: Hurray!