3
\$\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\$
6
  • \$\begingroup\$ Have you tried using a collection of BoxColliders instead? \$\endgroup\$
    – DMGregory
    Commented Aug 25, 2017 at 18:45
  • \$\begingroup\$ On an object that could potentially have tens of thousands of voxels, wouldn't that be too laggy? \$\endgroup\$ Commented Aug 25, 2017 at 18:49
  • 2
    \$\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
    Commented Aug 25, 2017 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\$ Commented Aug 25, 2017 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\$
    – House
    Commented Aug 25, 2017 at 19:48

1 Answer 1

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\$

You must log in to answer this question.

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