I made simple script that will align enemy with player rotation and distance:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FaceEnemy : MonoBehaviour {
[SerializeField]
Transform enemy;
public float distance = 1.67f;
private float x = 0f;
private float y = 0f;
void Update ()
{
y = enemy.transform.eulerAngles.y;
Quaternion rotation = Quaternion.Euler(x, y, 0f);
this.transform.rotation = rotation;
var position = enemy.transform.position - (rotation * Vector3.forward * distance);
this.transform.position = position;
}
}
thank you, but i think if you aligne the player to enemy is better