What’s the purpose behind this? When you mark a collider to behave as a trigger, it’s no longer used in the physics system, so why is it that unity’s triggering will only happen if you’re intersecting the mesh? If you set the mesh trigger as convex, it works great- but then you lose tons of precision…
Am I missing something here? What do you do when you want an “L” shaped trigger, for example? Unity only allows you to add a single box collider to a game object… are imprecise triggers the only way to go about it? That just seems… stupid. Assembling compound colliders in child objects and using them as triggers is a waste of time, since you’d also have to write a script that catches the trigger events on those game objects and reports back to the parent script.
Any ideas?
What do you mean by "intersection"? Surely triggers should be expected to fire when something intersects with them (in the sense that their solid forms overlap). You seem to be meaning something else.
Ah, you mean "intersects with the surface". Sounds like a bug to me, I've certainly never seen that documented anywhere. You're certain your Normals are pointing the right way, I assume?
yeah, as a test I even had unity recalculate normals at 180 degrees to make sure it wasn't 'breaking' the mesh on a hard edge and creating some sort of leak or something... still no dice.
Please don't invent new tags unless really necessary =/ 'imprecise' (is a special case of) -> 'precision'; 'mesh trigger' (does not exist as such, but) -> 'meshcollider', 'trigger'. (if you don't use space or uppercase while typing tags, you should get a dropdown-list of already existing tags as soon as you type at least two letters) Thanks :) Greetz, Ky.
I think this limitation makes sense from an architecture point of view, since calculating if a point is inside a concave mesh is very heavy computationally. For PhysX most common use of MeshColliders (handling collisions), only detecting collisions on the surface is sufficient. Anyways, as this is most likely a limitation in NVidia PhysX, you probably cannot get around it other then by approximating your shape with compound colliders.
A Mesh actually doesn't represent a volume. It's just a collection of faces. A Mesh doesn't need to be closed, therefore there's not really an inside or outside. The collision is checked with each face / triangle. That's why they are very heavy and why Meshcollider<-->MeshCollider collisions are not possible. A convex MeshCollider actually does represent a volume since it is forced to be closed. +1
Convex mesh collisions are, even if more expensive than primitive collisions, quite straightforward and simple to compute. Current physics engines don’t support concave dynamic objects mostly due to the fact that they are so expensive to solve.
This will change in the future (nvidia already has shown realtime fracturing and concave collisions) but right now it’s the only way to go. Unity uses PhysX, which is no different regarding this limitations.
The way to go around this is to use compound colliders, which you’ve already mentioned. But you can use triggers and they will report to the parent object automatically, so even if you use 20 primitive colliders as children you still use the same trigger event on the parent.
We’ve developed a Unity3D component that automatically computes a compound collider for any given object. It supports trigger events, so even if there are many colliders the event still can be processed at the parent level through the OnTriggerXXX callbacks.
I’ve created a small solution to this problem: a script together with an editor script that allows you to define a polygon together with a certain height. These polygons can be concave and work the same as normal physics triggers.
What do you mean by "intersection"? Surely triggers should be expected to fire when something intersects with them (in the sense that their solid forms overlap). You seem to be meaning something else.
– WazYou're not moving the mesh collider are you?
– Peter_GAh, you mean "intersects with the surface". Sounds like a bug to me, I've certainly never seen that documented anywhere. You're certain your Normals are pointing the right way, I assume?
– Wazyeah, as a test I even had unity recalculate normals at 180 degrees to make sure it wasn't 'breaking' the mesh on a hard edge and creating some sort of leak or something... still no dice.
– testurePlease don't invent new tags unless really necessary =/ 'imprecise' (is a special case of) -> 'precision'; 'mesh trigger' (does not exist as such, but) -> 'meshcollider', 'trigger'. (if you don't use space or uppercase while typing tags, you should get a dropdown-list of already existing tags as soon as you type at least two letters) Thanks :) Greetz, Ky.
– SisterKy