Oh hai! So I got this weird thing going on and what I’m trying to do is instantiate a particle system and use the Qauternion.Eular to rotate it smoothly back and forth in this part of my script:
if(flamePlayer)
{
if(addt)
{
t = Time.time + 4.0;
addt = false;
}
if(!addt && Time.time < t)
{
if(make)
{
flame = Instantiate(flameThrowerPrefab, spawn.transform.position, Quaternion.identity);
make = false;
}
flame.transform.localEulerAngles.y = transform.localEulerAngles.y;
flame.transform.localEulerAngles.x = -30;
flame.transform.rotation = Quaternion.Euler(-30,
Mathf.Sin(Time.realtimeSinceStartup * flameThrowerSpeed) * flameThrowerAngle,0);
}
if(!addt && Time.time > t)
{
Destroy(flame.gameObject);
addt = true;
atPlayer = false;
flamePlayer = false;
make = true;
move = true;
}
}
It will create the object and rotate it but…it will only rotate it in one direction, as if the object’s Y rotation is always at 0. I need the object’s Y rotation as same as mine.