Player pass through objects

I have a player that has this script:

using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {
public float movementSpeed = 10;
public float turningSpeed = 60;

void Update() {
	float horizontal = Input.GetAxis("Horizontal") * turningSpeed * Time.deltaTime;
	transform.Rotate(0, horizontal, 0);
	
	float vertical = Input.GetAxis("Vertical") * movementSpeed * Time.deltaTime;
	transform.Translate(0, 0, vertical);
}

}

The question is that my player pass through objects even with colliders or character controller. What can i do to prevent this?
Can someone help me on this please

Use forces from rigidbody, since you are directly adjusting the transform in the above code, you bet it will go through anything, direct changes to the transform do not take physics into account.

Please, write your code in a code block, using the “code sample” button in the text editor.

About your problem, the first thing I’d try is replace Update by FixedUpdate, since the bug is about physics.
The second would be lowering the movement speed.
Are you sure you have a collider on both the player and the objects ?

You should use Character controller instead of Collider + Rigidbody, I had the same issue and this works for me !

Adding a character controller if you do not use it is useless…

Moving character with Rigidbody like mentioned by @JordanSwapp is a solution and that would be the on for a case like gravity less game.

Now the best is as mentioned to go for CC alone and use the CC functions.

Check out this unitygems.com

There is a full tutorial to get your guy up and running and seeing you and even not seeing you and so on.