Search Unity

How do you set up a 'mesh collider' in a 3D package to import with visual mesh?

Discussion in 'Editor & General Support' started by Skinhinge, Aug 1, 2011.

  1. Skinhinge

    Skinhinge

    Joined:
    Aug 1, 2011
    Posts:
    6
    I am finding all kinds of references to 'automatically' attaching a 'mesh collider' while importing an FBX by using the checkbox.

    From Docs:
    Generate Collider - If this is enabled, your meshes will be imported with Mesh Colliders automatically attached. This is useful for quickly generating a collision mesh for environment geometry, but should be avoided for geometry you will be moving. For more info see Colliders below.

    Based on the information above: Does this simply mean the visual geometry will be used as collision or another mesh in the FBX file?

    New to Unity. 7 Years of experience in Unreal.

    In Unreal - you export a mesh named SM_Barrel in the same file with a mesh named UCX_Barrel. The mesh named UCX_Barrel becomes the collision.

    Is there anything analogous to this in Unity?

    Thanks ahead of time!
    Skinhinge
     
  2. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,609
    You model collider the object, make it a separate object from the main model, name it something like "Bound" or "Collision", then when you add it to your scene in Unity, add a mesh collider to it, and make it convex(or not). :)
     
  3. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Yep, model both (I generally just duplicate the main visual mesh, hide it and optimise the duplicate), export them separately, then on your main mesh in unity add mesh collider and choose your optimised collider mesh, it'll show in wireframe when you have your main mesh selected in the scene

    Choosing convex has unity create a convex version of your collision mesh, useful sometimes

    I've enjoyed unitys approach after using udk initially
     
  4. Skinhinge

    Skinhinge

    Joined:
    Aug 1, 2011
    Posts:
    6
    So you ave to attach them manually - it won't recognize it as collision on import?
     
  5. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,609
    Yes.

    It's a model. It doesn't do that. So, no.
     
  6. Skinhinge

    Skinhinge

    Joined:
    Aug 1, 2011
    Posts:
    6
    Cool, Thanks!

    UDK does recognize a model as collision upon import if named properly within the file. I assumed there was probably a similar functionality; thus my confusion.

    Again, thanks for the help!

    Skinhinge
     
  7. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You could probably write a post-process script to do that though.

    --Eric