Topic: Spawning secondary projectile for particle trails

Dear all.

I hope somebody can help me with this.  Basically the situation is that we are creating a fireball type move which has a VFX particle effect for the trails.  The problem being is that when the projectile hits, the projectile in the spawn pool is deactivated so all the effects dissappear also.  One possible work around I have looked at is spawning a secondary projectile which contains only the trail effects however it does not have any collisions so it will carry on.  2 problems present themselves with this approach

Even if I put the number of hits to 0 on this second projectile,  it still registers a hit and this causes problems such as the blocking player freezing.  I've also tried reducing blockable and hit areas to 0 with no success.

The trail particles , as expected do carry on through the player and to the other side of the screen.

The information / advice I would like help with is :
Where in the code does it detect if a projectile is hitting the player with a projectile.  If I can find this, I can add an additional menu item as a boolean and add an IF statement to say only if this is false, then perform the check.  This could then be applied just to the second projectile leaving it free to travel with no chance of registering a hit.

The second piece of advice is that I would like to potentially add an event on the first fireball prefab where on de-activation the trail prefab could have a script listening to that event and at that point set the emissions on the trails to zero and then de-activate after x many seconds (thus leaving it enabled so the pre-existing trails can dissipate naturally).  My only concern with this approach is if two players have the same character which casts this same fireball, if the event is detected, it would de-activate both fireball trails that are currently active.  I believe there is a unique ID for each projectile, what is the best way to access this to use in an IF statement so that it basically checks if its the correct event for its fireball?

I hope I have explained this clearly,  please let me know if you need any further info.  If there is a simpler solution, I am also interested in that.  Thanks for your help in advice.

Share

Thumbs up Thumbs down

Re: Spawning secondary projectile for particle trails

Lets try to keep this simple at first.
You could have a script that creates the trail object and sets some variables on a follow script of some kind.
Then in the Update loop simply check if the linked projectile is active in the hierarchy.

Share

Thumbs up Thumbs down

Re: Spawning secondary projectile for particle trails

FreedTerror wrote:

Lets try to keep this simple at first.
You could have a script that creates the trail object and sets some variables on a follow script of some kind.
Then in the Update loop simply check if the linked projectile is active in the hierarchy.

Hi Freed Terror
Thanks for the suggestion, I have thought about this however there are a few issues with this technique by itself so there would need to be additional steps as well as this.

If I have the script completely outside of the particle system sitting waiting , it would need to be looking every frame for new instances of the fireballs and then also be able to track that it applies the trails to the correct ones? 

If the script is part of the fireball prefab , I am going to have to move it outside of the prefab otherwise it will be de-activated when the fireball is de-activated.  This in itself may cause an issue with object pooling.

Share

Thumbs up Thumbs down

Re: Spawning secondary projectile for particle trails

When the fireball is spawned, simply get a pooled object and apply the settings you need to that follow script.
I can try to provide a code example sometime.

Share

Thumbs up Thumbs down

Re: Spawning secondary projectile for particle trails

FreedTerror wrote:

When the fireball is spawned, simply get a pooled object and apply the settings you need to that follow script.
I can try to provide a code example sometime.

I've managed to get round this by taking out the trail part of the effect from the main fireball and have it listen for an event when the fireball gets deactivated.  At this point it just shuts the emission down and the particle naturally ends.

Thanks for your advice.

Kind regards

Share

Thumbs up Thumbs down

Re: Spawning secondary projectile for particle trails

Alright, glad you figured it out.

Share

Thumbs up Thumbs down