0
votes

Hello Peeps (first post yay).

I have just started to learn about unity and still going through various tutorials and learning the interface along with C#.

I am running Unity 4 and downloaded a free asset from the Unity store: https://www.assetstore.unity3d.com/#/content/3174

The Problem. I created a Plane in Unity. Went to the Character and created colliders and imported it as a humanoid. Then added a rigid body = The character fell through the plane I then added a Mesh collider and attached the mesh for the character to the collider. The mesh does NOT align correctly to the character = the character fell through the plane. I then tried box and capsule colliders and they worked fine. Attached these and the character would not fall through. I then tried a character controller = Character did not fall through.

I want to have an accurate mesh for this test character so when an enemy hits him, there is an actual hit.

I have tried several other free characters from the store and they all have the same problem. Can someone please tell me how I can fix this? It seems I just either doing something completely wrong, missing a step or just plain lost.

Link below to image of the issue taken: enter image description hereenter image description here

4

4 Answers

2
votes

Using a mesh collider on a skinned, animated character is a wrong approach. Mesh colliders are generally used for environment geometry and rigid objects. This is all due to the amount of work it is needed for the Unity engine to accurately calculate the shape of the mesh collider, based on the provided mesh. More triangles means more work, and for the reasonably complex low poly character mesh of 10k to 30k triangles it is clear that the fps would most definitely drop to an unplayable level.

For our game we are using all primitive colliders, distributed on the adequate bone game objects. So, head bone has a sphere collider, spine has a box collider (for lungs), forearm has a capsule collider etc. That way,with a little bit of scripting, you can detect a hit and know exactly what part of body is damaged.

1
votes

If your collider doesn't exactly match your mesh, then it's likely that you have the mesh applied to the wrong part of the object.

Try applying the Mesh Collider to the mesh, instead of the complete object.

0
votes

You have a pretty complex character mesh, so using mesh collider probably isn't the best way to go. In many cases, character controller or capsule collider works fine; otherwise, you can just use compound collider and create a box or a sphere around various body parts of the character.

0
votes

This once happened to me. The mistake i made was, i applied the mesh collider after i did some rotation and scaling. So i added the mesh collider as soon as i imported the model. And then it should be alright when you scale/edit the model. Also check with right/left handed co-ordinate system with unity and 3D MAX/Maya.