- Home /
Question by
Bakuretso · Jan 17, 2017 at 08:04 AM ·
instantiateobjectmultipleonce
instantiate object only once in current position and than again in another
Hello everyone! I'm trying to instantiate projectile once from object gun, when he passes by position x == 0 and again when he passes x == 2, x ==4 and etc. To move it i use SimpleWaypointSystem. At first, i dont know why, the object does not respond in passing position with code:
void Update()
{
if(CurPos.x == 0)
shoot();
if(CurPos.x == 2)
shoot();
// and etc
}
And only respond with:
void Update()
{
if(CurPos.x > -0.1 && CurPos.x < 0.1)
shoot();
if(CurPos.x > -1.91 && CurPos.x < 2.1)
shoot();
//and etc
}
but in that case it instantiate a multiple projectiles, when i need just one. I tried to create triggers, but completely confused in this. I hope you can help me with this problem!
Comment