function Update(){
var hit : RaycastHit;
var fwd = transform.TransformDirection(Vector3.forward);
if (Physics.Raycast (transform.position, fwd, 100)) {
if (target.gameObject.tag == "Enemy"){
transform.LookAt(target);
}
}
}
I have this script that allows my character to Lock on to an enemy he's facing but he can no longer move left or right and can't rotate as long as he's within range. So I need to ask for 2 things:
1.) A method of free movement while locking onto the target.
2.) A method of breaking the raycast via button press (Disable the lock on feature)
Any help will be appreciated.