Is there a way to add a "lightning trail"

I want to add a lightning trail that follows the player around like “The Flash” if anyone knows who that is and i cant seem to do it. I dont think the particle system is the right way to do it as i can only do orbs or something.
Screenshot 2021-09-03 22.19.42|690x388
so far thats all i have but it’s only visible from the side. It’s an animated sprite which @agent178 created for me. Im wondering if there’s a way to make it so you can see it when running instead of having to turn your camera to see it. I appreciate any and all help!

Hi @Ehsaan_Khan,

It may not be exactly what you are looking for, but it can point to the right direction. You can use the Mesh API to create a dynamic mesh for a trailing effect:

https://developer.playcanvas.com/en/tutorials/rainbow-trail-with-mesh-api

1 Like

i dont understand how to use this can someone explain?

I’m thinking of some buffer hacks…

Say you created a “trail buffer”; in each frame all the objects that needs to be trailed would be rendered onto the buffer, and all pixels on the buffer would then diminish their opacity. Then you just lay the buffer layer directly onto the camera’s destination.

IDK if it’d work, but if you got to give it a try, please let me know how it goes.

I don’t know how to do what you’re suggesting as im relatively new to playcanvas so i showed this to one of my friends who’s very experienced and he also didn’t know what you were talking about, so i couldn’t attempt that unfortunately, but moving on i have another question. The project Leonidas shared i’d like to know if there’s a way to get the trailing effect to stay in place but show the colour at the back continuosly or whenever i moved which would be preferable but right now i’m more focused on the other thing. Please let me know if it is possible @Leonidas. If you aren’t quite sure what im asking i’ll explain it in depth.