How can i make an enemy face player as well as be parallel to the ground in unity
You could try using
trasform.LookAt(target);
if (Physics.Raycast(EnemyEyes.position, -EnemyEyes.up, out var hit, Mathf.Infinity, groundDetct))
{
transform.up = hit.normal;
}
This will first rotate the object to face directly with it's forward vector towards the target and then rotate it again slightly to match the up vector according to the ground.
Or as alternative pretty similar you could take the direction
Vector3 Current_Rotation = (target.position - transform.position).normalized;
and in case of a ground hit map it onto the plane of the ground like
if (Physics.Raycast(EnemyEyes.position, -EnemyEyes.up, out var hit, Mathf.Infinity, groundDetct))
{
Current_Rotation = Vector3.ProjectOnPlane(Current_Rotation, hit.normal).normalized;
}
transform.rotation = Quaternion.LookRotation(Current_Rotation);
then you can still use Slerp