Please help me i am getting really pissed. I wasted 2 hours in trying to figure out what is going on. My mesh colliders just don’t work. My trees also have mesh colliders, they don’t collide with my player. My raycast doesn’t detect my enemy’s mesh colliders when i am shooting at them. BUT, the box collider is working? I tried putting box collider and it seems to be working. However, box collider is not what i need. I haven’t messed with layers, tags or any other project settings. I tried disabling all the scripts in my scene, nothing worked. I am so mad for i wasted so much time not being able to solve so simple problem. It’s pointless making screenshot from my project. It’s a new project that has only 5 models imported to it, brand new project with a simple character controller. Any idea what may cause this problem? I searched trough all google results, i only found useless answers that didn’t work and wasted my time even more. When i started my project i expected to find issues while i am doing programming, not while doing simple shit like this. Excuse me for my bad tongue, i am so mad.
Box colliders work, mesh colliders don’t work.
there are no rigidbodies attached to any of the gameobjects except the player.
i tried testing while all the scripts were disabled and the mesh colliders still didn’t work.
Do you think that for 4 hours(6 actually) i didn’t saw that option? The thing is, that my enemy is animated and that mesh doesn’t fit. There is no mesh that i can put in that option.
EDIT: Also, my trees are generated by an asset… so they don’t have mesh either XD can you offer some other solution please ? lol
Okay i go to get some sleep now. My brain burned all of my calories today. Its so pathetic that this simple thing managed to kill 6 hours of my life. It will kill even more XD
Mesh collider needs a mesh to check collisions against. No mesh, no collisions. Is that simple. Without mesh, the MeshCollider component does nothing.
It’s up to you to provide a collider to the mesh collider components. It may be the same mesh used for the visual geometry, or a simplified mesh that approximates the shape and works good enough. FPS typically use capsule colliders for this.
Allright, understood. But how it is that in the past i was able to just add the mesh collider component without adding any additional mesh stuff? I’m confused af.
Did you add the mesh collider to the GameObject that also holds the MeshFilter? If not, the game object that you’re added the mesh collider to should have the same position, rotation and scale as the one rendering the mesh.
A mesh doesn’t magically appear in the “right” position. It’s transformed via the transform component. If you add a mesh collider to a game object that has a different transform than the game object rendering the mesh, their positions will be different.
May I ask why you need a mesh collider on a character ?
You do know it is not going to be animated with your character ?
But stay in this T pose forever .
This may be old, but I figured the answer in my case was that I had “Is Trigger” checked on the item I wanted to detect collision with. Soon as I unchecked this option, collisions started to work.
1- You need the mesh to be convex in order to work and enable the “convex” attribute in the variable
2- If your mesh is not convex, you have to divide it into several convex meshes, this one was really hard, I used Blender and this tool: GitHub - andyp123/blender_vhacd: Blender 2.80 add-on that enables the use of V-HACD inside Blender to generate accurate convex hulls quickly. but be careful, it is no longer maintained and it won’t work on the latest blender version, some dude uploaded a pull request that is not merged, but it worked: Update plugin for Blender 2.90 and add support for modifiers by tpdickso · Pull Request #8 · andyp123/blender_vhacd · GitHub Follow the first page instructions carefully but with the pull request’s script and you will be fine. I had to max out all the V-HACD parameters for my mesh.
3- unity only accepts up to 256 triangles for a mesh collider, so decimate if needed
4- import the meshes into unity, add the mesh collider to all of them, and mark the convex attribute
5- At this point, Unity still had the colliders wrong, very wrong, I had to open the “cooking options” property, set that to “None”, then disable “convex” and re-enable it again.