I have been trying to fix the rotation for my steering script. I’m trying to get the scripted 2d gameobject to always face the target and while I was able to get it to sort of look at the target it’s not looking directly at it. Do you guys have an suggestions for tweaks I could make?
void Seek (){
Vector3 direction = target.position - transform.position;
float moveHorizontal = transform.position.x - target.position.x;
float moveVertical = transform.position.y - target.position.y;
float zRotation = Mathf.Rad2Deg * Mathf.Atan2(moveVertical, moveHorizontal);
transform.eulerAngles = new Vector3(0, 0, zRotation + 50);
if(direction.magnitude > minDistance){
Vector3 moveVector = direction.normalized * moveSpeed * Time.deltaTime;
transform.position += moveVector;
}
}