Skip to content

Dynamic addition of particles #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: sample_color_model
Choose a base branch
from

Conversation

Vrixyz
Copy link
Owner

@Vrixyz Vrixyz commented Apr 11, 2025

create a bigger buffer than necessary + store a u32 to know the actual number of particles

Current status

Working 🎉 ; some polishing to do:

  • better way to update particles, or consider that out of scope for this PR.
  • 3d example
  • reviews
  • I consider rigidbody colliders out of scope for this PR

create a bigger buffer than necessary + store a u32 to know the actual number of particles

Not working yet.
@Vrixyz Vrixyz force-pushed the dynamic_add_particles branch from 1932085 to 0fbcbfd Compare April 14, 2025 09:15
@Vrixyz Vrixyz changed the title wip wip adding particles Dynamic addition of particles Apr 14, 2025
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename with postfix 2

phase: None,
color: None,
};
particles.push(particle_proto);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: fix bug where we access particles[0]

particle.position += vector![1.0, 0.0] * (i as f32) * cell_width * 1.1;
physics.push_particle(queue, &particle);
}
physics.reset_graphics = true;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: cleaner way to update graphics with same strategy.

mut materials: ResMut<Assets<BevyMaterial>>,
to_clear: Query<Entity, With<InstanceMaterialData>>,
) {
if physics_context.reset_graphics {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comment warnign about performance if we merge as-is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant