Hi all,
I currently have a group of rigidbodies (my enemies) looking at the player as he moves. I need to go a step further and have them transform forward toward the player upon him moving. This is currently what I have for the enemy looking at the player:
public class EnemyLook : MonoBehaviour {
public Transform target;
void Update () {
transform.LookAt(target);
}
}
This is my script for player movement:
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis ("Mouse X");
float moveVertical = Input.GetAxis ("Mouse Y");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
rigidbody.AddForce(movement * speed * Time.deltaTime);
}
I’m still getting to grips with C# and Unity so any help will be greatly appreaciated.
Thanks