0
\$\begingroup\$

I have MeshColliders in my scene that are shaped like an hourglass and it works perfectly fine in the editor. However, once I build on XCode and test on my iPhone, the MeshColliders don't respond at all as if they weren't there.

Why is this happening and what are the reliable alternatives for creating this functionality besides creating a bunch of box and sphere colliders to make a cohesive pseudo-hourglass shape?

\$\endgroup\$
1
  • \$\begingroup\$ What are the specific symptoms of "don't work anymore"? Can you edit your question to walk us through the steps to create a Minimal Complete Verifiable Example of the problem? Once we can reproduce the same issue you're facing, we can test potential fixes to be sure they'll work for you. \$\endgroup\$
    – DMGregory
    Jun 16 at 15:32

1 Answer 1

1
\$\begingroup\$

First, try checking the "Convex" box in the mesh collider options just to see if the issue is related to that. If it is, you don't need a "bunch of box and sphere colliders", you can just use two convex cones arranged like an hourglass.

You should also read the documentation about Mesh Colliders because it notes some important quirks:

  • GameObjects that have a Rigidbody component only support Mesh Colliders that have Convex option enabled: the physics engine can only simulate convex mesh colliders.
  • For a Mesh Collider to work properly, the Mesh must be read/write enabled in any of these circumstances:
    • The Mesh Collider’s Transform has negative scaling (for example, (–1, 1, 1)) and the Mesh is convex.
    • The Mesh Collider’s transform is skewed or sheared (for example, when a rotated transform has a scaled parent transform).
    • The Mesh Collider’s Cooking Options flags are set to any value other than the default.

As for why it's behaving differently on iOS than in the Editor, this could be due to a bug in Unity, or it could be related to your project settings (e.g. if you are using lower-detail meshes on iOS, or have code that is wrapped in #if UNITY_IOS directives).

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .