Bevy Points

Points mesh plugin for Bevy.

Usage
System setup
Add the plugin to your app:
use bevy::prelude::*;
use bevy_points::prelude::*;
fn main() {
App::new()
.add_plugin(PointsPlugin);
}
Apply a component to a MaterialMeshBundle
fn setup(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<PointsMaterial>>,
) {
let n = 320; let h = 3.0; commands.spawn((
Mesh3d(meshes.add(
PointsMesh::from_iter((0..n).map(|i| {
let t01 = (i as f32) / ((n - 1) as f32);
let r = t01 * TAU * 4.0; Vec3::new(r.cos(), (t01 - 0.5) * h, r.sin())
})),
)),
MeshMaterial3d(materials.add(PointsMaterial {
settings: PointsShaderSettings {
point_size: 20., ..Default::default()
},
perspective: true, circle: true, ..Default::default()
})),
));
commands.spawn((
Mesh3d(meshes.add(
PointsMesh::from(Mesh::from(Sphere {
radius: 1.0
}))
)),
MeshMaterial3d(materials.add(PointsMaterial {
settings: PointsShaderSettings {
color: Color::BLUE,
opacity: 0.5,
..Default::default()
},
alpha_mode: AlphaMode::Blend,
..Default::default()
})),
));
}
Compatibility
bevy |
bevy_points |
0.9 |
0.1 |
0.10 |
0.2 |
0.11 |
0.3 |
0.12 |
0.4 |
0.13 |
0.5 |
0.14 |
0.6 |
0.15 |
0.7 |