- Home /
Question by
EliteHedgehog56 · Mar 13, 2019 at 09:31 AM ·
aicontrollercputank
cpu version of tank controller script
I am wanting to add bots to my tank battle game, how hard would it be to convert my player tank controller into an cpu tank controller that drives around on it's own?
private var controller: CharacterController;
var speed: float = 6.0;
var turnSpeed: float = 90;
function Start(){
controller = GetComponent(CharacterController);
}
function Update(){
var movDir: Vector3;
transform.Rotate(0,Input.GetAxis("Horizontal1")*turnSpeed*Time.deltaTime,0);
movDir = transform.forward*Input.GetAxis("Vertical1")*speed;
// moves the character in horizontal direction
controller.Move(movDir*Time.deltaTime-Vector3.up*0.1);
}
Comment
adding random behaviour easy, creating complex IA if you dont know how to do it really hard even with tutorials.
Your answer
Follow this Question
Related Questions
AI enemy vechicle problem 2 Answers
Need Help Creating my Tank AI Controller! 1 Answer
Pong AI/Paddle controller help 1 Answer
NavMeshAgent With Mecanim 3 Answers
AI for check obstacle 0 Answers