Making a cube part of a scenary

Hi. I’m trying to create my first mini game in Unity3d. I have already created the movement logic of my character and the camera and now I would like to test it moving around a scenary. For it, I have just built a long floor and a cube on it, which should never move, since in a real game, it would be a tree for instance. I have tried setting to it a mass of 9999, and it seems to be working, because even if I touch it with my character, it doesn’t move. The problem is, that my character seems to be entering a bit inside the cube, maybe because the velocity of the collision or something like that…

Then, what I have to set to the cube in order to transform it like an inanimated and immovable object?


Add a rigidbody and move using:

transform.rigidbody.AddForce(direction * speed);

This can be a little annoying to get this type of movement correct but will lead to proper collision detection.

Simply moving the transform doesn’t give the game engine any adequate way of checking for detections and that’s where you’re having trouble. Very common problem.