- Home /
Cubes collide with terrain
Actually I have 2 question that relates to the same subject: I'm trying to stop the movement of the cubes when they're collide with the terrain.
I did some custom shapes in blender and imported the files to unity, the shape are falling from the "sky" and need to stop when they hit the terrain, I added via script (C#) a rigidbody and checked the convex of each shape resource, butthey are falling through the terrain..
I tried to check if it happens too with primitive shapes from unity, I set a primitive cube in my scene, added a rigidbody and checked the use gravity, the cube has a box collider and it's trigger checked also. The terrain has terrain collider and it checked.but when i start the scene the cube is falling and go through the terrain.. what is the problem?
Any Ideas? tutorials on how to create shape colliders with terrains?
Answer by Mmmpies · Dec 30, 2014 at 11:17 AM
Trigger turns a collider into a a trigger, it no longer collides it just notices that something has breached it's borders. Switch isTrigger off and try it again.
Hi thanks for your answer, so how it can be done? I also tried when to write some code when the onColliderEnter occurs but nothing helps..
It's OnCollisionEnter for colliders, OnTriggerEnter for triggers.
Note that Unity is case sensitive so onCollisionEnter is not the same as OnCollisionEnter.
You need to use OnCollisionEnter
Oh and let us know if it is fixed.
Your answer
![](https://koobas.hobune.stream/wayback/20220613175137im_/https://answers.unity.com/themes/thub/images/avi.jpg)