I created an enemy object which has a model and wrote a script that makes the enemy face the player when the player is close. However, when I get close the model of the enemy is rotating wrong, i.e. it should be rotated 90 degrees to make the model face the player correctly. Here is a pic of the problem:
You can see how the model is facing the player sideways (and its like that all the time when following the player, I tried to somehow add 90 degrees to the enemy object and make the model face the player correctly but I don’t know where to modify that or how. The code for rotation is this:
private void Update()
{
if (Vector3.Distance(igrac.position, this.transform.position) < 10)
{
Vector3 direction = (igrac.position - this.transform.position);
direction.y = 0;
this.transform.rotation = Quaternion.Slerp(this.transform.rotation, Quaternion.LookRotation(direction), 0.1f);
}