- Home /
Mesh Colliders on concave objects from C4D
I'm pretty new to Unity and I'm sorry if it's a already covered question
So I have modeled a simple object in Cinema4d (a traffic cone) and I want to be able to pile up a number of this object on Unity
This is my Cinema4d model :
I simply drag and drop the c4d file into Unity, don't forget to hit the "generate colliders" checkbox on my object and add 2 on my scene
In order to pile these up I added a Rigid Body on my objects and a Mesh Colliders on each element on my object (as read on the net) I check the Convex checkbox (again as read on the net) and I ended with this :
As you can imagine my traffic cones don't pile up at all, there are 2 Mesh Colliders (in green, on on the actual cones and one traversing the bases) which block the pile up
How can I fix this in C4D or Unity ? I'm forgetting something here, how do you pile up concave objects in Unity ?
Thanks for your answers
EDIT(after Kryptos answers) : The best approach so far is with coumpound colliders (look at my answer) but I got weird behaviour
Answer by Kryptos · Sep 07, 2012 at 09:18 AM
Don't generate convex mesh, there are expensive and will look (and behave) strange because of the way the convex hull is generated.
In your case, you should use a BoxCollider or a CapsuleCollider (or a compound with a thin BoxCollider at the bottom and a CapsuleCollider on top of it). It will be less expensive and more predictable.
edit (after your comment):
In that case, convex collider can't do. The hole makes the collider concave.
You can try to achieve it by playing with combination of BoxColliders (3, 4 or more) and a SphereCollider at the top.
Another solution would be to keep a concave collider by using a low-poly version of your cone and assigning this low-poly version to the mesh property of the MeshCollider. But concave colliders do have limitation regarding the physics simulation. And in your case the limitation would break what you want to achieve: concave colliders cannot collide with each other.
Thanks for your answer BoxCollider and CapsuleCollider work great but It doesn't match what I want to achieve I want the traffic cones to be able to pile up one into the another (like a jack 3.5mm into a jack or a finger on a nose :p) I don't know if I'm clear here, sorry for the poor explanation
I'll try to go with your solutions (combining many colliders and low-poly version), I wasn't aware I have to face this kind of problem with concave items ! I think I'll have to work with many colliders to emulate the cone on solution 1. I'll keep you informed about it
The problem with concave collider is that it is not possible to deter$$anonymous$$e whether their shape interpenetrate (at least not in real time). And even with convex colliders it is computationaly expensive.
Primitive colliders are cheap and fast because that are mainly mathematical formulas: SphereCollider is a distance to a point, BoxCollider is a range, CapsuleCollider is a distance to a segment line.
In my answer below I applied a lot of Colliders (like 30), does it sound a good solution for you ?
Sounds like a lot. Can't you just achieve the same behaviour with just four collider on the sides and adding constraint (forcing the rotation for example) to make sure the cones are aligned with each other?
Answer by Fluckysan · Sep 10, 2012 at 11:37 AM
I applyed your solution (coumpound colliders) :
The cone pile up but sometimes with weird behaviour (bouncing, passing through others colliders)
Answer by UGTools · Oct 10, 2012 at 11:01 AM
Hi Fluckysan,
Usually the process would be creating a compound collider by hand, but in this case I'm afraid the object is quite hard to decompose manually into primitive colliders. We just developed a component for Unity3D that can help you with the problem you are facing (and maybe face in the future):
http://www.youtube.com/watch?v=mu__FxT8Gzk
It is available at the Unity3D Asset Store: http://u3d.as/content/ultimate-game-tools/concave-collider/3rS
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
C4d r13 import problem 1 Answer
Is there a way to shake an Object fast? 1 Answer
"E" to grab an object... 3 Answers
Imported object not visible 4 Answers