Reply
Reply
 
Thread Tools Display Modes
samcole's Avatar
Old (#1)
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?
Offline , spline, 206 Posts, Join Date Feb 2010, Location MI  
   Reply With Quote

MikeF's Avatar
Old (#2)
the mesh colliders can be quite sporadic when combined with certain other built in colliders, check out this list at the bottom of the page for some info
http://unity3d.com/support/documenta...hCollider.html
Portfolio -- www.mikefortais.net --
Offline , polycounter, 1,201 Posts, Join Date Nov 2004, Location Toronto, Ontario  
   Reply With Quote

Brendan's Avatar
Old (#3)
I recently built a racing game with Unity, and there's some tricks to collision in Unity.

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.
Offline , triangle, 360 Posts, Join Date Dec 2010, Location Brisbane  
   Reply With Quote

samcole's Avatar
Old (#4)
Our game that we are creating involves a single player character running around in a pseudo-side scrolling environment. The camera can sometimes switch to a more over the shoulder view at times.

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.
Offline , spline, 206 Posts, Join Date Feb 2010, Location MI  
   Reply With Quote

justifun's Avatar
Old (#5)
I think you need to make sure your environment is marked as "static" as well.
Offline , null, 18 Posts, Join Date Jan 2012,  
   Reply With Quote

samcole's Avatar
Old (#6)
I've seen that checkbox on individual assets, but are you talking about the environment as a whole? I have no idea where that would be marked.
Offline , spline, 206 Posts, Join Date Feb 2010, Location MI  
   Reply With Quote

justifun's Avatar
Old (#7)
Are you talking about a terrain mesh? or a mesh build in an external application and imported into unity. If its the latter, you can select all of the parts or even just the parent object and click static, and it should ask if you want to also apply it to the rest of the childen objects.
Offline , null, 18 Posts, Join Date Jan 2012,  
   Reply With Quote

samcole's Avatar
Old (#8)
Just individual static meshes, built in Maya, exported as FBX into Unity. I'll have to check off that box this weekend, but we have major modeling to catch up with so who knows when I'll be able to test out those different boxes again.
Offline , spline, 206 Posts, Join Date Feb 2010, Location MI  
   Reply With Quote

warby's Avatar
Old (#9)
what exactly are your collision issues are you falling through the floor ? getting stuck ? not moving with animated objects like doors/elevators ?

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 !
Offline , polycounter, 838 Posts, Join Date Dec 2004, Location boston hamburg copenhagen  
   Reply With Quote

samcole's Avatar
Old (#10)
The collision problem is the character doesn't correctly collide with anything we import in from Maya. The character will fall through the floor, not correctly hit a table, go through the wall, etc.
Offline , spline, 206 Posts, Join Date Feb 2010, Location MI  
   Reply With Quote

holyjewsus's Avatar
Old (#11)
I'm sure you are, but just to be clear, you're checking generate mesh colliders on import?
Offline , null, 20 Posts, Join Date Apr 2011,  
   Reply With Quote

samcole's Avatar
Old (#12)
Yes.
Offline , spline, 206 Posts, Join Date Feb 2010, Location MI  
   Reply With Quote

holyjewsus's Avatar
Old (#13)
I also once had an issue of my controller falling through colliders, I believe recreating the controller solved it... just throwing out ideas!
Offline , null, 20 Posts, Join Date Apr 2011,  
   Reply With Quote

samcole's Avatar
Old (#14)
Thanks jolyjewsus, I'll let my team know today when we meet. I'll probably do some trial and error this weekened if I have time.
Offline , spline, 206 Posts, Join Date Feb 2010, Location MI  
   Reply With Quote

warby's Avatar
Old (#15)
increase the skin width of the character controller above 0.1 !
Offline , polycounter, 838 Posts, Join Date Dec 2004, Location boston hamburg copenhagen  
   Reply With Quote

samcole's Avatar
Old (#16)
Warby, I actually was able to do that last weekend, and it did help a lot. We are just moving a head with what we have, and our static meshes are going to be used just for decoration. I'll post some screenshots when we are finally done in 2 weeks. I'm so ready for Spring Break.

Thanks everyone for all the tips and suggestions. This has really been a learning process tackling a new engine.
Offline , spline, 206 Posts, Join Date Feb 2010, Location MI  
   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright 1998-2012 A. Risch