1
\$\begingroup\$

Whenever I add a Rigidbody component to an object with a non-Convex Mesh, Unity throws this error:

Non-convex MeshCollider with non-kinematic Rigidbody is no longer supported in Unity 5. If you want to use a non-convex mesh either make the Rigidbody kinematic or remove the Rigidbody component. Scene hierarchy path "Ship/BlockHolder/MeshHolder [0]", Mesh asset path "" Mesh name "MeshHolderTemplate(Clone)"

https://docs.unity3d.com/Manual/class-MeshCollider.html

After doing some research, it appears that I need to either enable the "Convex" setting for the Mesh Collider (which is NOT what I want - my objects require concavity)

or enable the "Is Kinematic" option for the Rigidbody component (which is NOT what I want either - from what I can see, Kinematic objects cannot be pushed by other objects)

The end goal is this: https://www.youtube.com/watch?v=O_UXKce9-OY&t=41s

(I can add the destruction later, for now, I just want the objects to be able to move and not intersect with each other)

How do I do this? I am completely lost here. Is this impossible in Unity?

\$\endgroup\$
  • \$\begingroup\$ Have you tried using a collection of BoxColliders instead? \$\endgroup\$ – DMGregory Aug 25 '17 at 18:45
  • \$\begingroup\$ On an object that could potentially have tens of thousands of voxels, wouldn't that be too laggy? \$\endgroup\$ – Aaron Franke Aug 25 '17 at 18:49
  • 1
    \$\begingroup\$ You expect tens of thousands of individual triangle checks against every face of a mesh to be faster? ;) With both you'd naturally do everything you can to eliminate redundant collision data, like spanning long flat areas with a single collider instead of subdividing it for every constituent voxel. But there's a certain minimal complexity you've already committed to by using a 10000+ voxel shape in the first place and requiring its collision to honour concavity. Not much you can do to escape that, though you can break it down into smaller chunks to work with at a time. \$\endgroup\$ – DMGregory Aug 25 '17 at 18:55
  • \$\begingroup\$ If I were to use BoxColliders, is there a well-optimized algorithm for merging BoxColliders? (A line would become a single long BoxCollider) \$\endgroup\$ – Aaron Franke Aug 25 '17 at 19:15
  • 1
    \$\begingroup\$ Here's some related questions: gamedev.stackexchange.com/questions/109687 gamedev.stackexchange.com/questions/129648 gamedev.stackexchange.com/questions/125927 You'll need to figure out how to add a dimension to the algorithms :) \$\endgroup\$ – MichaelHouse Aug 25 '17 at 19:48
1
\$\begingroup\$

This answer applies to anyone who's willing to pay $9 for an asset on the Unity Asset Store.

I found this script which builds "compound colliders" out of BoxCollider colliders. These colliders allow me to use a non-Kinematic Rigidbody on my voxel objects.

The example scene needs some tweaking to get working in the latest Unity, but the script works fine.

http://productivity-boost.com/DownloadNonConvexMeshCollider.html

https://www.assetstore.unity3d.com/en/#!/content/84867

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.