1

I am trying to make 5 bullets shoot in different directions at once (-30, -15, 0, 15, 30)

It works when I shoot in right direction, but when I shoot left(rotation(0,-180,0) , it ignores its rotation and moves in straight line.

For bullet move I am using:

if (t.rotation.y.Equals(0))
{
    t.Translate(t.right * bSpeed * Time.deltaTime);
}
else
{
    t.Translate(t.right * -1 * bSpeed * Time.deltaTime);
}

For bullet Rotation:

for (int i = 0; i < 5; i++)
{       
    GameObject bt = objectPool.SpawnFromPool(Bullet, firePoint.position, firePoint.rotation);

    switch (i)
    {
        case 0:
            bt.transform.Rotate(0, 0, -30);
            break;
        case 1:
            bt.transform.Rotate(0, 0, -15);
            break;
        case 2:
            bt.transform.Rotate(0, 0, 0);
            break;
        case 3:
            bt.transform.Rotate(0, 0, 15);
            break;
        case 4:
            bt.transform.Rotate(0, 0, 30);
            break;
    }            
}

Working Working as I intented... moving toward where they are facing.

Not Working Not working. I want this each bullets to move as their rotation.

Please help me!

Muhammad Tariq
  • 3,318
  • 5
  • 38
  • 42
sEUf Cho
  • 11
  • 1

0 Answers0