Skip to content

Commit

Permalink
clean up and better description
Browse files Browse the repository at this point in the history
  • Loading branch information
naasblod committed Oct 29, 2024
1 parent e897dff commit b6ba52e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions examples/ribbon.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<<<<<<< HEAD
//! Uses with_ribbons to draw a "tracer" or a "trail" following an Entity.
=======
//! Uses the [RibbonModifier] to draw a "tracer" or a "trail" following an Entity.
//! The trail effect is achieved by using the [CloneModifier] on the "head" particle in combination
//! with the [RibbonModifier].
>>>>>>> 8508ca1 (clean up and better description)
//! The movement of the head particle is achieved by linking the particle position to a CPU position using a [Property] in [move_head].
//!

Expand All @@ -19,15 +25,15 @@ use utils::*;
const K: f32 = 0.64;
const L: f32 = 0.384;

const TIME_SCALE: f32 = 10.0;
const TIME_SCALE: f32 = 6.5;
const SHAPE_SCALE: f32 = 25.0;
const LIFETIME: f32 = 1.5;
const TRAIL_SPAWN_RATE: f32 = 256.0;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let app_exit = utils::make_test_app("ribbon")
.add_systems(Startup, setup)
.add_systems(Update, move_particle_effect)
.add_systems(Update, move_head)
.run();
app_exit.into_result()
}
Expand Down Expand Up @@ -112,7 +118,7 @@ fn setup(mut commands: Commands, mut effects: ResMut<Assets<EffectAsset>>) {
.insert(Name::new("ribbon"));
}

fn move_particle_effect(
fn move_head(
mut gizmos: Gizmos,
mut query: Query<&mut Transform, With<ParticleEffect>>,
mut effect: Query<&mut EffectProperties>,
Expand All @@ -129,7 +135,6 @@ fn move_particle_effect(
0.0,
) * SHAPE_SCALE;

//let pos = vec3(f32::cos(theta), f32::sin(theta), 0.0) * 5.0;
properties.set("head_pos", (pos).into());
gizmos.sphere(pos, Quat::IDENTITY, 1.0, YELLOW);
transform.translation = pos;
Expand Down

0 comments on commit b6ba52e

Please sign in to comment.