I managed to get a guy working who can run around and has a gun. Except the bullets dont fire out in line with the barrel. I think the issue would be in this line:
Code: Select all
var bullet = Instantiate(bulletfab, GameObject.Find("Barrel").transform.position, Quaternion.identity);
Code: Select all
if (LookAtTarget)
{
var rotate = Quaternion.LookRotation(LookAtTarget.position - transform.position);
//transform.rotation = Quaternion.Slerp(transform.rotation, rotate, Time.deltaTime * damp);
transform.rotation = Quaternion.Slerp(transform.rotation, rotate, Time.deltaTime * damp);
//var seconds : int = Time.time;
//var oddeven = (seconds % 2);
if (Time.time>=lastshottime+1) {lastshottime=Time.time;Shoot();}
}