Hello every one,
This is my first question and I come from Belgium.
I’m creating a game with a friend, he does the sound. The idea is to follow an “invisible path”. If you leave the path, weird sounds are happening and environment is changing. So I want the controller to follow a path. And when he leaves it, he enters the “zone”. On right and left of the path, I place 2 invisible long meshes that delimitate the path. They are not straight, made with blender. IsTrigger is On.
So here is my problem : I try to get a “true” if I’m inside a mesh and “false” if I’m out. The only way to get a volume detection between a mesh collider and a character controller is to trigger the “convex” mode On. With Primitive Shapes Colliders, if I’m inside a giant box, the method OnTriggerExit only sends a message if I leave the entire volume. With a Mesh Collider, as soon as you’ve entered the mesh, the OnTriggerExit message is sent, just after the OnTriggerEnter method. The OnTriggerStay method doesn’t change anything. Only the surfaces work as a trigger. So I have to ‘check’ the convex mode On, and it works for shapes that have less than 255 triangles. If higher the number, he redisigned the collider shape to maximise the number of triangles at 255. If I have a path like an ‘S’, The collider doesn’t fit anymore on the mesh. It seems I can’t decide wich triangles are selected.
So I think I reached a limit of Unity but maybe because there is something more I didn’t see. A little trigger to activate somewhere. Or maybe because another solution to the “path” problem exists and I couldn’t think of it.
I created a scene to describe the problem. I have the .unitypackage or .rar but Ican’t post them with the question, it says ‘file type invalid’. I don’t know if I can post dropbox link but here they are :
unity package : https://dl.dropboxusercontent.com/u/50617115/ConvexMeshColliderTest.unitypackage
rar : https://dl.dropboxusercontent.com/u/50617115/ConvexMeshColliderTest.rar
In the scene, there are : a terrain, an fpsController, a cube and a “side of the path” with the convex mode On.There is also a script atteched to the 2 meshes to debug.log “in” if the controller is inside of the shape and “out” if he’s outside.
Thanks in advance for reading this and for your time,
Unity rules,
LeMoine