Using box collider or rigidbody, to stop object from going through another one.


I’ve designed an object that responds to mouse clicks, let’s say, if I click on my terrain via mouse the object moves to that point, on the terrain as well there is another object similar to a wall, the problem is that when i click on the wall the moving object goes through it and it doesn’t stop when it reaches it. How can i make the wall solid nothing goes through it, I heard about box collider but didn’t work for me. Any help please, I would prefer to use the method of adding rigidbodies and box colliders as they are a lot easier than adding code into my script.

Any help is hugely appreciated.

Have you tried adding rigid bodies to both objects, and ensured the ‘wall’ objects’ Collider is NOT set to trigger?