Crates.io | berdicles |
lib.rs | berdicles |
version | 0.1.0 |
source | src |
created_at | 2024-06-26 19:27:23.280893 |
updated_at | 2024-07-04 19:50:03.91523 |
description | Expressive CPU particle system for the bevy engine. |
homepage | |
repository | https://github.com/mintlu8/berdicles |
max_upload_size | |
id | 1284802 |
size | 240,728 |
Expressive CPU particle system for the bevy engine.
Material
and Mesh
.ParticleRef
.Non-features
Add a ParticleSystemBundle
, which is a MaterialMeshBundle
with a ParticleInstance
.
First we need to add ParticleMaterialPlugin
, not MaterialPlugin
, which sets up a different render pipeline.
We only use vertex_shader()
and fragment_shader()
from Material so the rest can be ignored.
This uses the mesh as the particle shape and the shader for instancing. The StandardParticle
is already setup
in this crate, but you can define your own Material
by referencing this shader's source code.
To create a ParticleInstance
we need a ParticleSystem
trait implementor and a Particle
that it spawns.
Physics based particles is commonly seen in most particle system implementations, but they might be frustrating to work with in some situations. We provide alternative ways to implement particles, instead of defining things as velocities, forces or curves.
impl Particle for SpiralParticle {
fn update(&mut self, dt: f32) {
self.lifetime += dt;
}
fn get_transform(&self) -> Transform {
Transform::from_translation(
Vec3::new(self.lifetime, 0., 0.)
).with_rotation(
Quat::from_rotation_y(self.lifetime)
)
}
fn expiration_state(&self) -> ExpirationState{
ExpirationState::explode_if(self.lifetime > 8.)
}
}
SubParticleSystem
uses a parent particle system's particles as spawners for other particles.
ParticleParent(Entity)
to point to a parentas_sub_particle_system
to your ParticleSystem
implementation.Yes you can chain these infinitely.
EventParticleSystem
can listen to events like particle despawning or colliding and spawn particles on events.
ParticleParent(Entity)
to point to a parentParticleEventBuffer
to the parent to record these events,as_event_particle_system
to your ParticleSystem
implementation.We can render trails behind particles as mesh.
TrailedParticle
on your particle.on_update
, detach_slice
and as_trail_particle_system
to your ParticleSystem
implementation.TrailMeshOf(Entity)
to a MaterialMeshBundle
to render them.bevy | berdicles |
---|---|
0.14 | latest |
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.