Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

libGDX ParticleEffect runtime velocity change

I have a flame ParticleEffect as the exhaust from a rocket. While the rocket moves slowly, the flame looks nice, but when the rocket starts moving very fast the flame can't really keep up because its particle speed is relative to the world and not the rocket. The result is blips that disappear from screen in parts of a second.

Can I update the emitter velocity during runtime, or can I set some kind of velocity point of reference to the particle effect (also during runtime)?

Thanks for any help!

like image 914
Kim Avatar asked Nov 11 '22 11:11

Kim


1 Answers

It'd be a nice idea to encapsulate your particle effect inside an actor (like here).

Unfortunately the documentation is currently somewhat lacking, but you can always look at the source.

Now looking at that, the velocity value seems read only. So the answer to your question seems to be no.

But to fulfill your requirements, I'd suggest you to create 2 or 3 (or more) particle effects suitable for different velocities. (Much easy). Now you can change the entire effect during runtime.

Hope this helps.

like image 55
Tanmay Patil Avatar answered Nov 14 '22 21:11

Tanmay Patil