- Home /
Concave rotation Collision problem
Hi,
I'm pretty new to Unity, and I'm having a pretty significant problem with collision. I need to have objects collide with the edges of rotating objects. I know that's hard to visualize, so here's a video of the setup which shows the issue I'm having:
It looks like the issues happen whenever the rotating objects collide with the spheres at a certain angle, such as when the spheres hit the extruded portion of the outer circle. I'm semi-proficient at scripting, but this one's a bit over my head. Any thoughts on the best way to approach this?
Answer by Statement · Jan 23, 2011 at 11:50 AM
You probably need to construct convex collider components for this to work well in practice. I my personal experience, non-convex mesh colliders are horrible when used with anything moving due to tunneling artifacts. You can build any concave model from convex composites.
From looking at your video, the wheel should be constructed using 24 convex colliders (one for each segment that can be made convex) and the cross thing in the middle should be constructed using 6 or so convex colliders (4 for the ends, and 2 shafts).
There might be other ways around this. Is your character controller physics driven?
Answer by johnBenge · Jan 27, 2011 at 11:32 PM
Thanks for your response. I re-constructed the collision setup using box colliders, and it does work a lot better. There are still issues that happen when parts of the circle thing rotate into the bombs, sometimes they get bumped above the circle, but other times they fall through. The character is not dynamically controlled at the moment, though I plan to incorporate that as soon as I'm satisfied with the collision for other objects.
Here's the project, if anyone can come up with a working solution, I would greatly appreciate it.
Sorry about all the adds on the download site, just go straight to the bottom and click the actual link, not any of the crap that says "download now" or whatever
Answer by UGTools · Oct 30, 2012 at 04:46 PM
You should be able to use a non-convex mesh collider for the circles as long as the elements that interact with them use primitive colliders (spheres, boxes, capsules) or a convex mesh collider. That way the collider will be the mesh itself and collisions should be precise.
If that is not the case then your circle needs to be convex because unity's physics engine doesn't support non-convex mesh to mesh collisions. One solution to that would be to approximate the circle with box colliders, but collisions would not be so precise and it takes a lot of work to set up.
We've developed a component for Unity3D that creates automatically multiple convex colliders for a given object. It could be useful in your case for the circle, which seems to be the most complicated part, in case the previous solutions don't work for you.
Here is a video to see how it works: YouTube
It's available at the Asset Store: link