I'm working on a senior project, and we chose Unity to run our level. We are having serious collision detection issues with all the meshes we try to import in from Maya. I don't set up any previous collision in Maya before exporting with the FBX format. Unity ships with a collision creator for static meshes so it seemed simple enough.
I'm using Maya 2012, and the latest version of Unity. Has anyone else had issues with Unity's mesh colliders? Also, most answers I've been finding from Google are suggesting people are writing their own custom scripts for collision detection, is that normal?
Replies
http://unity3d.com/support/documentation/Components/class-MeshCollider.html
Firstly, if you want two things to collide well, one has to be marked as convex. This option should be under the collision information section on the object in the inspector. For our game, we had the cars as convex (this means no holes or scalloped out bits, think of it as if you wrapped it in lycra), and the track and terrain as not convex.
Complex colliders, for example guns, can be made out of a bunch of basic collision primitives. The box collider is very fast, and you can have a bunch of those all attached to the gun to make a rough gun shape and it'll work.
Apart from that, it's very simple in Unity. Just make sure you add a box/sphere/pill/mesh collider (component>physics>...collider).
In the settings somewhere you can change physics timestep, max setps, and collision layers. Don't mess with these unless you know the consequences of messing with them, and you will only know the consequences of messing with them by messing with them. At least do it on a build you can (and will) throw away.
The only things that will be colliding of note will be the character when she runs into environment objects, and monsters if we keep our combat mechanics.
Thanks for the responses though, it might be the fact that we were using a simple pill for our Alpha presentation which doesn't accurately reflect what our character will be in terms of collision.
I've tried adding different kinds of colliders to a mesh to see if it gets detected, and none were working. We'll keep poking at it this weekend though. If I have a breakthrough I'll post what I do.
in gemeral :
never have a mesh collider vs mesh collider collision
your main character should remain a capsule dont make cubes for individual limbs and than expect the animations of those limbs to have any effect on the colision/locomotion of your char if the characters arm reaches out it will reach through a wall regardless of what the colliders say
under some circumstances collisions become more reliable when you attach a rigidbody remove the gravity flag and set it to kinematic
important physics objec/rigid bodys that are not just for visual detail but have an effect on game play should be set to continues dynamic !
Thanks everyone for all the tips and suggestions. This has really been a learning process tackling a new engine.