Wall collisions for a top-down game

Hi! I’m trying to make a game like the old-school top-down Zelda games, but I can’t figure out how to setup the collision on my character. I’m using a regular cube just to practice with, but I plan to make my game in 2D.

I’ve already tried rigidbodies on my character. It stops it from going any further, but it makes it really jumpy when I hit something and keep pressing on the same button. Colliders I’m not exactly sure how to code it so I can have nice smooth stopping like in Zelda. Which is best for my situation and can anyone please give me some starter code (preferably JavaScript)? I’ve spent 3 days researching this topic on Google, Unity Forums, Unity Answers, and Unity Wiki. I would really appreciate any help! Thanks so much!

BTW here is the original code for my main character
var speed : float = 5.0;

function Update () 
{
	var transH : float = Input.GetAxis("1P Horizontal") * speed * Time.deltaTime;
	var transV : float = Input.GetAxis("1P Vertical") * speed * Time.deltaTime;
	
	transform.Translate(transH, transV, 0);
}

Try adding a Character Controller to your player. Then change your above code to the following

function Update () 
{
    var transH : float = Input.GetAxis("1P Horizontal") * speed * Time.deltaTime;
    var transV : float = Input.GetAxis("1P Vertical") * speed * Time.deltaTime;
 
    GetComponent(CharacterController).Move(transH, transV, 0.0f);
}

Then by having just a box collider on the walls with Is Trigger unchecked should give you the collision results you are looking for.