Ai code
Posted: Mon Jan 24, 2011 3:37 pm
i'm trying to make a capsol move aourd in random directions. but the problem in when ever it moves forward in ignores collitions and just goes strait in to the terrian. here is my code if anyone could help that would be awsome.
Code: Select all
var speed : float = 6.0;
var rotateSpeed = 3.0;
var gravity : float = 20.0;
var prefab : GameObject;
var saveTime = 0;
private var turnTime = 3;
function Update() {
moveDirection.Vector3.forward;
if(Time.time > saveTime){
turnTime = Time.time + saveTime;
transform.Rotate(Vector3.up, Time.deltaTime * rotateSpeed, Space.World);
}
moveDirection.y -= gravity * Time.deltaTime;
}