Deterministic fallible_systems example (#17813)
# Objective - `fallible_systems` example is not deterministic ## Solution - Make it deterministic - Also fix required feature declaration
This commit is contained in:
parent
7398d33b79
commit
cff17364b1
@ -2156,13 +2156,13 @@ wasm = false
|
||||
name = "fallible_systems"
|
||||
path = "examples/ecs/fallible_systems.rs"
|
||||
doc-scrape-examples = true
|
||||
required-features = ["bevy_mesh_picking_backend"]
|
||||
|
||||
[package.metadata.example.fallible_systems]
|
||||
name = "Fallible Systems"
|
||||
description = "Systems that return results to handle errors"
|
||||
category = "ECS (Entity Component System)"
|
||||
wasm = false
|
||||
required-features = ["bevy_mesh_picking_backend"]
|
||||
|
||||
[[example]]
|
||||
name = "startup_system"
|
||||
@ -4000,7 +4000,6 @@ name = "Sprite Picking"
|
||||
description = "Demonstrates picking sprites and sprite atlases"
|
||||
category = "Picking"
|
||||
wasm = true
|
||||
required-features = ["bevy_sprite_picking_backend"]
|
||||
|
||||
[[example]]
|
||||
name = "debug_picking"
|
||||
|
@ -6,6 +6,8 @@ use bevy::math::sampling::UniformMeshSampler;
|
||||
use bevy::prelude::*;
|
||||
|
||||
use rand::distributions::Distribution;
|
||||
use rand::SeedableRng;
|
||||
use rand_chacha::ChaCha8Rng;
|
||||
|
||||
fn main() {
|
||||
let mut app = App::new();
|
||||
@ -68,7 +70,7 @@ fn setup(
|
||||
mut meshes: ResMut<Assets<Mesh>>,
|
||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||
) -> Result {
|
||||
let mut rng = rand::thread_rng();
|
||||
let mut seeded_rng = ChaCha8Rng::seed_from_u64(19878367467712);
|
||||
|
||||
// Make a plane for establishing space.
|
||||
commands.spawn((
|
||||
@ -116,7 +118,7 @@ fn setup(
|
||||
});
|
||||
|
||||
// Add sample points as children of the sphere:
|
||||
for point in distribution.sample_iter(&mut rng).take(10000) {
|
||||
for point in distribution.sample_iter(&mut seeded_rng).take(10000) {
|
||||
sphere.with_child((
|
||||
Mesh3d(point_mesh.clone()),
|
||||
MeshMaterial3d(point_material.clone()),
|
||||
|
Loading…
Reference in New Issue
Block a user