Skip to content

Conversation

@ThierryBerger
Copy link
Owner

@ThierryBerger ThierryBerger 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.
@ThierryBerger ThierryBerger force-pushed the dynamic_add_particles branch from 1932085 to 0fbcbfd Compare April 14, 2025 09:15
@ThierryBerger ThierryBerger 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.

2 participants