fbpx

 

Coding Triple Shot
 

Coding Triple Shot  

   RSS

0

Hey so I'm not sure if I am posting this in the correct spot so forgive me if I am wrong. Anyways my issue has been while working on the space shooter course. I set up my triple shot and it seems to lag behind my character. If i move to the sides of the screen while shooting it the lasers seem to stick towards closer to the center of the screen. However it seems as if behind the screen the lasers are still colliding with the enemy on point. 

 

Spoiler
Triple Shot Code

void FireLaser()
{
_canFire = Time.time + _fireRate;

if (_isTripleShotActive == true)
{
Instantiate(_tripleShotPrefab, transform.position, Quaternion.identity);
}
else
{
Instantiate(_laserPrefab, transform.position + new Vector3(0, 1.5f, 0), Quaternion.identity);
}
}

@sorenkurosaki

Please double check that Z position transform for the empty Game Object holding the lasers and the each laser inside the Gameobject are set to 0. You will want to open the prefab to check this(double click the triple shot prefab in the project view window.)

The triple shot is a common problem here.

2 Answers
0

*Answered*

 

Please double check that Z position transform for the empty Game Object holding the lasers and the each laser inside the Gameobject are set to 0. You will want to open the prefab to check this(double click the triple shot prefab in the project view window.)

The triple shot is a common problem here.

@thom-foxx

So im not sure what I did wrong but I went back into my game to do some testing and the lasers seem to be off centered again. However all the Z positions for each laser and the prefab are set to 0.

@SorenKurosaki
If you have discord, It might be quicker to help you figure it out there.

@thom-foxx

No sadly I don't use discord. It gave me a bunch of issues a little while back and didn't want to cooperate with my computer so I got rid of it.

The lasers are offset a bit to the right. I've fiddled around with the numbers to try and get it right but it doesn't seem to wanna line up with my spaceship.

0

I just went through the same issue, seems like all the transform positions get messed up when converting to a prefab.

I changed the transform of the prefab to be 0,0,0

Change the value for each laser to be correct within the prefab view (-0.8, 0, 0) (0, 1.2, 0) (0.8, 0, 0) (left - middle - right).

Now it works for me correctly.

Share:

 

 

Scroll to Top

Please Login or Register