I've been using Unity for over a year and a half and suddenly I'm having a really basic problem! I've got two different objects, both with convex mesh colliders. Neither will collide. I've checked the collision Matrix in the physics settings. I've tried adding a rigidbody to both of them, marked it as Kinematic, but this doesn't work. The only way I can get the objects to collide is to add a non-kinematic rigidbody to one. But this is then affected by Physics, which I don't want. Is there no way to get two convex mesh colliders to register contact?
Did you check your collider meshes don't have more than 255 triangles ? It they do then no convex collision…
Both the collider meshes are under 65 triangles - originally I was using primitives, but replaced them with simple meshes built in Blender so I could try convex collision. Now I know Unity can handle collisions between meshes that don't have rigidbodies but I'm damned if I can get it to work in this case. Only works if I attach a non-kinematic rigidbody....
Doesn't work with a kinematic rigidbody. If I change the value in the inspector while running to make the rigidbody non-kinematic it works instantly. Why not with kinematic? I thought that would register a collision with convex mesh collider.... I am stumped...
Ah ok I had missed that one. Your issue is not "convex or not convex." It's kinematic which disables physics. Read the doc : Guess you must look for another way to do what you want… maybe some script that enables / disables iskinematic when needed / not needed ?
I read the doc many times. I don't want physics - at all. I simply want two colliders to detect when they touch. But I can't get this to happen unless I add a non-kinematic rigidbody. So my question is: How do I get two mesh colliders / primitive colliders to register collision, without physics?
then you want physics. without physics colliders never move and thus also will never detect a new collision (something that can not move can logically not start touching something either, either it always did or it never does) you would then not use colliders at all anymore, but raycast and alike
Where the doc says "kinematic rigidbodies are not affected by collisions" I am assuming they still register contact - only that they are not affected by any forces, due to physics. Anyone at Unity confirm this?
I'm moving the colliders via their transform in script. I have two boxes - one static, one controlled by the player via transform in script. I simply want the boxes to register if they touch. Why introduce physics? Aren't convex colliders and non-kinematic rigidbodies for this very purpose?
There must be hundreds of situations where you don't want the overheads of physics calculations, especially if you are moving things that have no force of inertia etc. (i.e something that moves instantly to the mouse position on screen). How do you detect a collision between two meshes, without physics? As mentioned, non-kinematic and convex don't appear to do it. If I make the colliders triggers, then other objects in the game which are physical won't bounce off them.
I don't know if I made myself clear Dreamora, I just want a result from OnCollisionEnter. No Physics, no forces, just confirmation if the objects touched.
I mean the doc clearly states Convex colliders can collide with other convex colliders. Except mine won't register the contact. And I've checked everything - collision matrix etc...
Here's a quick example project, with two convex mesh colliders. They don't register collisions. Why not? http://www.iwari.com/unity/
They won't; see the collision matrix at the bottom of this page in the docs. As you can see from that chart, though, two kinematic triggers will register OnTriggerEnter, so you might be able to use triggers. This is reasonable because programmatically moving an object inside another object should not happen as far as physics is concerned; in order to get any kind of collision info that makes sense, it has to come from the physics engine. This is why OnCollisionEnter has Collision info passed in, whereas OnTriggerEnter only has Collider info. If you can't use triggers and need colliders, then one of the objects must be non-kinematic, and in order to move it completely deterministically instead of with forces, you can use Rigidbody.MovePosition instead of Transform.Translate. --Eric
Thanks Eric, you're right - the info is there (though the collision matrix in the user manual isn't clearly presented (could do with being in a marked grid with a bit more spacing around the entries as it's hard to scan). I went astray where the docs state 'convex colliders can collide with other convex colliders'. That statement in isolation is a bit misleading.
Hey, I know this thread is really old, but I'm running into your same problem. I don't have a a solution though. Very simple setup. I have asteroids with rigidbodies and I have asteroids without. They both have mesh colliders, neither is a Trigger. When I press play and fly around, I watch the smaller asteroids float around AND through each other. I have scripts on the static asteroids that should blow up the smaller asteroids OnCollisionEnter. Unfortunately, the static asteroids aren't reading collisions either! All the asteroids have no collision detection. However, when I shoot them with lasers, the lasers read the collision and apply damage, then blow up. Also, enemy spaceships (that also have rigidbodies and move by applying force) will register collisions with asteroids and knock the dynamic ones around! I have been using Unity for over a year as well and I have no idea why this is happening. Am I just being retarded and forgetting something obvious? Either way, I have a deadline and I can't figure this out. Help would be greatly appreciated from someone (especially from Unity). I've exchanged the mesh colliders for sphere colliders, when I do that the collisions work perfectly (besides the fact that lasers wont hit perfectly on the asteriods). I would really like to be able to get collisions from a non convex, normal mesh collider.
thank you so much. thats basically what i did here is the thread i posted the solution, with images http://forum.unity3d.com/threads/mesh-collider-with-trigger-but-not-convex-in-unity5.307925/