Make particles actually workable
WIP, adds a way to nicely create spawn behaviors for particles and define their spawn data (at the moment collisions in the game are broken so particle collisions are also kind of messed up, also includes changes from currently open particle prs)
example command:
/particles cubyz:poof ~ ~ ~ false 200 .{ .type = .sphere, .radius = 10, .mode = .direction, .direction = .{0, 1, 0} , .coneRadius = 0.5}
at the end you see a zon spawn configuration where you can define a spawn shape to use (point, sphere, cube) and their corresponding data, for example a sphere needs a radius whereas a cube needs a size which takes a vector3, also you can see you can use a mode which sets the fly direction of the particle (spread, scatter, direction) direction is the only one which needs to be defined with a value so if you want something else you would do this:
/particles cubyz:poof ~ ~ ~ false 500 .{ .type = .cube, .size = .{10, 10, 0}, .mode = .scatter}.
Another example:
/particles cubyz:poof ~ ~ ~ false 10 .{ .type = .point, .mode = .spread}
the difference between spread and scatter is that spread will make the particle go in a direction from its center, and scatter goes randomly.
You can also set spawn properties such as drag, density, velocity, rotationVel, lifeTime (all of those take .{0, 0} vector 2 values and the first element means minimum and second maximum), randormRotate (which takes true or false), .color = .{0xff00ff, 0x00ff00} and .colorRandom = .channel (only one option here for now, idk how else i could make it).
example:
/particles cubyz:flamew ~ ~ ~ false 750 .{ .type = .sphere, .radius = 0.25, .mode = .spread, .density = .{ -0.5, -3 }, .velocity = .{20, 30}, .drag = .{10, 15}, .color = .{0xff00ff, 0x00ff00}, .colorRandom = .channel}
examples for spawning using code are in physics.zig line 240, and renderer.zig line 1115
you can also now set spawn properties such as drag, density, velocity, rotationVel, lifeTime (all of those take .{0, 0} vector 2 values and the first element means minimum and second maximum) and randormRotate (which takes true or false)
i think this is ready for a review, i left some example code for using this new api in physics.zig and renderer.zig. this should also be a good time to finalize the data that particle (and its type) should contain and where
rebased
drag has no use now so im removing it
all changes have been made
should i add terminal velocity or some sort of slowing forse to particles? so that its possible to create nice explosion clouds, particles could spread out quickly and stop quickly making a nice cloud
should i add terminal velocity or some sort of slowing forse to particles?
I think a factor that scales the actual friction coefficient would make sense (called drag coefficient in physics)
please update to the new Zig version
done
done