Basically in my update function for my hero i have an update which is calling this method on an enemy. However the enemy only ever looks left, or right. Can anyone help with this?
function SeekPlayer(shipLoc : Vector3) {
transform.LookAt(shipLoc);
var rot = Quaternion.LookRotation(transform.position - shipLoc, Vector3.forward);
transform.rotation = rot;
transform.eulerAngles = new Vector3(0, 0,transform.eulerAngles.z);
rigidbody2D.AddForce(transform.up * 3);
}
↧