Custom particle update of position has no effect

Hello everyone!

I have been toying with particle systems and it seems the custom update function has no effect:

I managed to make the stretching effect from How to create a Particle Stretch Effect for Warp Speed in a simpler way by using BILLBOARDMODE_STRETCHED for the particles instead of changing the angle.

In this playground I have a spaceship (the cube focused by the camera) that is going through the warp tunnel and the emitter of the tunnel (the other cube).

As the emitter is attached to the spaceship, particles world velocity are their initial velocity plus the velocity of the spaceship.

This is problematic because the effect breaks down rapidly when the velocity of the ship increases.

This could be mitigated by using isLocal=true for the particle system but then the tunnel would behave unnaturaly when rotating the spaceship (with IJKL) as their would be no bending of the trajectory of the particles.

What I want to do is artificially remove the velocity of the spaceship by updating the positions of the particles each frame. Subtracting the displacement of the ship should do the trick I think.

I am trying to change the positions in the onBeforeRenderObservable and I am not getting a lot of success.

I also tried using a custom update function but it also seems to have no effect.

Does someone know what I am doing wrong here?

1 Like

Let me add @Evgeni_Popov who built the warp particles of the previous post :slight_smile:

1 Like

I tried a number of things but could not come up with a solution…

Maybe @PatrickRyan will have some ideas?

Thanks for trying!

I commented the entire body of the custom update function and… nothing changed? Except for the fact that the particle recycling was not handled and therefore the effect eventually stops.

This is so weird, maybe the cylinder emitter overrides the position of the particles?

I removed the cylinder emitter and still I can’t change the positions of the particles :confused:

Okay I finally fixed it!

Basically I needed to use onBeforeParticlesRenderingObservable and update the particles there. The other issue was also that I computed the anchor displacement for each particle which is completely dumb and my bad ^^’

2 Likes