Model wont follow gun
Hi all.
I have a animated model downloaded from Unity Asset Store and I'm trying to add a muzzle flash on it that gets activated when enemy shoots.
Well everything is working fine so far, until enemy shoots. Muzzle flash stays on where it is put on and wont follow the gun.
Muzzle flash is a child of a gun.
Heres picture that hopefully clears what I mean.
That green muzzle flash circled by red should be in the pipe of gun and not in the ground.
Any ideas how to fix it so it would follow gun?
[EDIT] Muzzle flash is a small triangle model using particles shader, not an animation.
Is the muzzle flash definitely in the correct initial position? does anything change the position of the muzzle flash programatically? Perhaps try creating a child gameObject on the barrel of the gun and add your muzzle flash as a child of that ins$$anonymous$$d (so it's a grandchild of the gun). I don't know if this will help, but you could give it go :)
Yes, its definitely in the correct initial position.
Nothing changes the position of muzzle flash programatically, it gets just activated.
Also creating a child gameObject on the barrel of the gun and adding a muzzle flash to it didnt help at all.
Answer by Reefer · Jan 29, 2017 at 04:39 PM
Anyways I fixed it by doing a code that changes it on position of empty gameObject positioned on barrel and then activates.
So the problem is now fixed, but I'd like to know what caused it to not move with the gun?