#Need help with Instantiating particle system with the right rotation.

1 messages · Page 1 of 1 (latest)

frank cliff
#

im creating a top down shooter, i have this gun attachment thats supposed to flash enemies but when Instantiating the vfx the rotation is messed up, please help me, if you need any more info feel free to ask

quasi sage
#

I think you are rotating around the wrong axis in
Vector3 FlashVFXrot = new Vector3(weapon.transform.parent.rotation.z, 90, -90);.
I wouldve Expected something like new Vector3(0, 0, weapon.transform.rotation.z);.

frank cliff
#

have tried it but then particle system goes circle like this

quasi sage
#

Try:

GameObject vfx = Instantiate(
                flashVFXPrefab,
                weapon.FirePoint.position,
                weapon.transform.rotation
            );
#

or if FirePoint is a Transform thats setup correctly use weapon.FirePoint.rotation instead.

Are both the weapon and the VFX setup such that their orientation should align?

quasi sage
lapis fjord
#

You should be never be touching or even thinking about transform.rotation.z to be perfectly honest.