I have a gameobject (Enemy) that is in the middle of the scene and the player can move in a circle around it. This enemy is rotating constantly towards the player and what I want to do is to initiate prefabs using the enemy’s Y rotation + an offset that increase for each prefab instantiated. x/z = 0
public GameObject m_SpawnPoint;
public Transform m_Enemy;
void WaveAttack(float m_ProjectileAmount, int m_ProjectileType, float m_Spacing)
{
for (int i = 0; i < m_ProjectileAmount; i++) {
Instantiate(m_Projectile[m_ProjectileType], m_SpawnPoint.transform.position, Quaternion.Euler(0, m_Enemy.rotation.y + (m_Spacing * i), 0));
}
}
It works except that m_Enemy.rotation.y does not equal the y rotation of the enemy. If I debug it says it equals to 0.01800914 no mather the rotation of the enemy.
Anyone know what I’m doing wrong? How do I fix this?
I could not find anything about this on here.