Repository navigation
Feature/particle graph - #116
Merged
Merged
Conversation
Particle effects become scene objects that logic graphs and code control: - ParticleEffect scene object (props: effect, playing, wind) in a group of its own that the editor and graphs move; dropping an effect from Assets places one, so it is saved with the scene - Effects and emitters get play(), stop(clear), burst(count) and alive; the state also reaches emitters added later - Particles graph nodes (client only): Spawn Effect, Play / Stop / Burst / Remove Effect, Effect State, On Effect Finished. An empty Effect input is Self. Nodes reach effects through a ParticleHost, given to them with the new `services` of the graph runtime - Properties panel: a looping preview and Play / Stop / Burst buttons (new `buttons` and `particlePreview` fields) - Logic graph editor: a preview pane running the graph in a world of its own (GraphPreview), restarted on every change, with a pick for Self, Restart, Send Message and keys going to the graph - Particles move with a Wind prefab in the scene (Emitter.windVelocity(), windInfluence per emitter, a wind switch per effect) Fixes in the particle system: - Smoke puffs never grew: their scales were never flagged for upload - Smoke drew a fixed number of pixels per puff, small up close and huge from afar; puffs now have a size in the world - Smoke never showed without a smokeTexture resource; it falls back to a soft disc. A Smoke removed before its texture loaded no longer creates its emitter afterwards - Rain and Smoke now register outside the editor too, so a saved scene's effects load in a game - Emitters were disposed twice; the base update flags alphas too - The editor's effect auto-import skips tests and build output
- PooledEmitter: a CPU emitter over a pool of particles, let out at a rate, in repeated bursts or by burst(); each moves with its velocity, gravity, drag and the wind, can bounce off the ground, and changes size, color and opacity over its life. Subclasses only say where a particle starts and how fast it goes - Fire (flames and embers), Sparks, Dust Puff and Explosion (flash, fireball, sparks and smoke, burst scaled per part) on it; Snow falls through a box on the GPU like Rain, swaying and blown by the wind - particleShapes: the world-size factor for attenuated points (Smoke uses it too) and a soft round dot - Effects can register an icon for the asset list; Smoke and Rain carry theirs instead of the editor special-casing Rain - The asset preview plays the whole effect, not only its first emitter - The editor's effect auto-import also finds classes extending any emitter (not EventEmitter)
usesParticleNodes(graph) finds a node of the Particles category, the engine's or a plugin's; the graph editor shows the preview pane for those logic graphs only.
- PooledEmitter particles with a bounce cast their step through the client's physics world, where terrains, primitives and scatter layers already keep their colliders: they bounce off the surface they hit along its normal, lose `friction` along it and come to rest. One starting inside a collider passes through rather than sticking. Without a physics world, or with collideWithScene off (the editor's previews), they bounce off the emitter's own ground as before - `fadeOut`: the part of a particle's life it fades out over - Debris: rocks and dirt thrown up, bouncing and rolling to a stop. Sparks (and the Explosion's) now hit the scene too
- Particle effects get a `collider` option (scene object prop, Properties checkbox, Spawn Effect input, collideWithScene in code), off by default: only with it on do bouncing and settling particles cast rays through the physics world; otherwise they use the effect's own flat ground and make no physics checks at all - PooledEmitter: `stick` (stays where it lands; landed particles neither move nor cast rays), `restFor` (how long it lies there), `steer()` for extra forces, `sizeVariation`, and the current wind for subclasses - Snow is a pooled emitter now: flakes sway, blow, start upwind and settle where they land for 8 to 15 s before melting; the sky starts full - The physics debug view draws where particles hit colliders, as short lines along the surface normal: particles aren't in the physics world, so Rapier had nothing of theirs to draw
- ctx.registerParticle(name, entry) in client plugins: the effect goes by `<package>:<name>` in scene files and graphs (returned), and the editor shows its label with the plugin's name wherever an effect is picked. Documented in the CLI README with a PooledEmitter example - Particle effects get an `aroundCamera` option (scene object prop, Properties checkbox, code): new particles start around the camera, sideways, rather than the emitter, and those already out stay where they are. Rain centres its box of drops on the camera, wrapping drops past its edge - Snow covers 40 m instead of 24, as dense as before
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.