- Home /
Terrain doesn't collide with my mesh
I have a player with mesh collider and a terrain with terrain collider. My player has rigidbody attached wich is Kinematic. In the mech collider, the IsTrigger is checked. I have an other cube, with cube collider.
If i go through the cube, in the log i see "Colled", but if i go through the terrain, i cant see anything. My code is here:
void OnTriggerEnter(Collider col) {
Debug.Log("Colled");
}
void OnTriggerExit(Collider col) {
Debug.Log("Exit");
}
void OnTriggerStay(Collider col) {
Debug.Log("Stay");
}
I want to see Colled in my Log, if i go through the terrain. Thank you for the help!
I tried tonns of solutions, i cannot solve the problem!
Nvm, I tought your terrain has the mesh collider. Did you attached this script on the object you want to fire it?
It worked, but if i use Convex mech collider, i should use box collider too, so it is not necessary to use mesh collider, but i want. How can i trick the system?
I solved! Thank you for help gajdot, you should make it as answer, and i'll tick it for a good answer.
Answer by gajdot · Nov 19, 2013 at 01:44 PM
Try to make you mesh collider(your object) a convex mesh. The problem probably is that you are trying to collide two mesh collider(the terrain collider is a type of mesh) which I remember right it won't collide, but when you are hitting the cube you have a primitive which fires correctly. So try to make your mesh collider convex(you can tick in the inspector) or try to replace with a primitive collider and try it out that way.