I have an object shaped like an isosceles triangle:
When my engine moves it around by manually setting its position, it needs to collide with other objects as a trigger, most of which are simple box colliders with kinematic rigidbodies. I've given it a mesh collider, which without being marked as convex, works perfectly in colliding with everything except other triangles, since non-convex mesh colliders don't detect each other.
When I try marking it as convex and moving the triangle perpendicular to its width, it gets really buggy passing through a normal box-collider object, still thinking it's colliding well after it's passed through to the other side by a good 10 units or so. Other objects moving into the triangle work fine. The mesh has 208 triangles, within the 255-triangle limit imposed on convex mesh colliders, and I've tried setting its rigidbody's collision detection to continuous/continuous dynamic to no avail.
Creating umpteen child objects with long, rotated box colliders to fit the shape and fill in the end corners complicates my code just for this one case, introducing yet other bugs, but that's what I've ended up having to do.
I'm curious - are convex mesh colliders this buggy for everyone?
Edit: I've created a minimized sample project showcasing the issue; download it here.
Move the 3 triangles with the scroll bar at the bottom through the 3 boxes slowly, and notice the difference between the triangle with the convex mesh collider (on the left), the one with the non-convex mesh collider (center) and that of the box collider (right). Two of these things are kind-of the same; can you guess which one of these doesn't belong?
Looks like a submittable bug, no?
Good call regarding the bounding box, Bunny83. That's why it works fine moving side to side in the direction of its acute corners, but not forward/backward or up and down. Thus since it only happens when you pass all the way through to the other side, something's faulty in triggering OnTriggerExit() beyond checking its Collider.bounds.extents.
It also only seems to happen for small, narrow collision obstacles; if you scale the little rectangle up to about (5,5,5), it then works OK.
There's a good several days of my life for ya.
answered May 23 '12 at 08:09 PM