Moving my object

Hello, I have been trying to get my object (a cube) to move forward, left, and right for a while. It has a rigid body. This is what I have been using. (Csharp)

using UnityEngine;
using System.Collections;

public class Rigidbodymovement : MonoBehaviour {

	public float move = 0f;
	public float turn = 0f;

	// Update is called once per frame
	void Update () {
	if (Input.GetKey (KeyCode.W))
			rigidbody.AddRelativeForce (Vector3.forward * move, ForceMode.Acceleration);



	if (Input.GetKey (KeyCode.D))
			rigidbody.AddTorque(Vector3.up * turn, ForceMode.Acceleration);

	if (Input.GetKey (KeyCode.A))
			rigidbody.AddTorque(Vector3.up * -turn, ForceMode.Acceleration);

		}
}

This works, HOWEVER, it will start to rotate because of friction and start bouncing all over the place. Is there anyway to make it so it will slide forward instead of moving like a wheel rotating forward?

Thanks,

SonicWave

In the rigidbody properties in the Inspector, there are checkboxes for Freeze Rotation, select those are you should be good.

I tried that, it worked. However, it is very unsmooth. Is their a way I can make it look smooth. And it is also moving to the right (slightly) when I move, Why would that be?

EDIT: When I run it straight, it starts to rotate to the right

Instead of using rigidbody.add force to move the object, try simply adding to the gameObject’s transform.position.

So how would I add this to my person. How would I use transform.position in this context? (Sorry, I am very new to unity. Thanks for helping me btw)

here’s a good tutorial it helped me on this. Granted I am new but I believe this would help you. https://www.youtube.com/watch?v=qstJlkyNeZk&feature=youtu.be

Thanks very much!!! That helped me a lot!