I have a game that player is the cube. That cube moves around like 2D side scrolling game. The cube has a rigidbody and box collider to it. When the player moves toward the wall, and touch the wall, a bit later, the player suddenly goes through the wall. I have searched this site for the solution that have written before, but what I found doesn’t match my condition.
Transform does not call the Physic components of your rigidbody, thus it ignores all physic. Colliders are physic component, for your code to include them you must move your objects using it’s rigidbody physics.
ie: When I do an AI that need to have perfectly controlled movement, I manage the Velocity of the rigidbody through code.
Depending on what you want to do and your ease with physics, you may want to use the Character Controller, it’s essentially a rigidbody with simplified functions to be controlled as a Character.