I attached a script to a first person controller called Run_Forward so that the user automatically runs forward without pressing a button. However when I run into objects I go right through them or the objects are pushed out of the way. When I freeze every position and rotation on the object I just run through the object. Please help. My code is below.
using UnityEngine;
using System.Collections;
public class Run_Forward : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.A))
transform.position += Vector3.right*4;
if (Input.GetKeyDown(KeyCode.D))
transform.position += Vector3.left*4;
transform.Translate(0, 0, .2f);
}
}