Cube moving through rigid body

I have a cube which is moving. Whenever a rigidbody comes in contact to it, it moves the rigidbody out of its path.

However in some of the situations, the rigidBody is in the path of the cube and the cube moves through the rigidbody.

For example as here in the pic, the red is the movable cube and the grey is the RigidBody -

The cube is moving with the script -

transform.position = Vector3.MoveTowards (transform.position, patrolPoints [currentPoint].position, moveSpeed * Time.deltaTime);

If you want the files [|51033]

Transform has this issue, it doesnt play well with the physics portion of the game.

Double check a few things though: kinematics are not selected,both cubes are perfectly on the some Y plane, either object isnt partially through the floor,

MovePosition is a much happier command to use.

I think you should check with the “moveSpeed”, it is calling in update(). so, even though it collides the moveSpeed is updating every frame. Make moveSpeed = 0; when it collides to blue cube, you can use OnCollisionEnter() for it.

Hope this helps you.