Below are some PG’s which shows how could you emulate particles with GreasedLine.
@CodingCrusader As you’re the math king and the procedural creator mastermind in my eyes could you tweak this PG to create some cool effects? I don’t have time to play with the math nowadays.
It could be used to simulate small sparks very easily too w/o the heavy particle system stuff. Fireworks, or whatever else…
HINT: you can control the line length dynamically by the visibility property. It would be cool if someone figures out the math to calculate the dash values for a single GRL instance with multiple lines (the dash values applies to the whole instance) so the whle thing could run in 1 draw call.
Actually, I would rather think this could be a perfect fit for ‘pixelart’. With something just a little bit more ‘squarisch’ like (rush)
I can easily imagine explosions and other particles fx (flames, water splash, etc…) in pixel art using this method. As for the maths, I will gladly let @CodingCrusader impress us and inspire us as this is clearly not part of my skillset
addPoints(points: number[][]) // adds points to the existing ones and recreates the mesh
setPoints(points: number[][]) // sets the points and recreates the mesh - the number of points must be the same as in the original line
Please notice the last sentence - otherwise adding points will not work - just moving the existing ones around!
I am so curious buddy!
From the docs:
Please note that points property is not updatable unlike when using a LineMesh. You have to use the property offsets on the line instance to update the position of points without recreating the mesh. Updating the offsets doesn’t involve any calulcations and updated only one vertex buffer. See below the Offsets section and the PG example Offsetting line vertices.
However there are two public methods available on the line instance for manipulating the points. Both of these functions will destroy the mesh and create a new one. This point manipulation method is slower but if you are not dealing with a lot of lines it should not cause FPS issues.
javascript
addPoints(points: number[][]) // adds points to the existing ones and recreates the mesh
setPoints(points: number[][]) // sets the points and recreates the mesh - the number of points must be the same as in the original line
If you are using the right handed coordinate system please create the lines after you switch the scene to it.
If you modify the number of points in the line you have to set the widths for the new lines or lines segments prior calling any of these two methods.
And after blowing a tire on the German Autoban, I can say that when you are standing up on the road waiting for assistance, it feels more like Mach1 or Mach2