Player phases through walls and terrain

It was working a few months ago, I had my player run up and down a slope hundreds of times and now it won’t work. What do I need to fix? Here’s my code:
using UnityEngine;

public class Movecube : MonoBehaviour
{
public float speed = .1f;

// Update is called once per frame
void Update()
{
float xDirection = Input.GetAxis(“Horizontal”);
float zDirection = Input.GetAxis(“Vertical”);

  Vector3 moveDirection = transform.right * xDirection + transform.forward * zDirection;

  transform.position += moveDirection * speed;
}

}

Does your player and wall/terrain have some kind of collider?