fix snapshots in 2d examples (#875)

This commit is contained in:
Hayden Flinner
2025-11-21 11:12:05 -05:00
committed by GitHub
parent 945072130f
commit da2b0a8a8a
2 changed files with 12 additions and 16 deletions

View File

@@ -1248,21 +1248,17 @@ fn update_testbed(
state
.action_flags
.set(TestbedActionFlags::TAKE_SNAPSHOT, false);
// FIXME
println!(
"!!!!!!!!! Snapshots are not working any more. Requires broad-phase serialization."
);
// state.snapshot = PhysicsSnapshot::new(
// harness.state.timestep_id,
// &*harness.physics.broad_phase,
// &harness.physics.narrow_phase,
// &harness.physics.islands,
// &harness.physics.bodies,
// &harness.physics.colliders,
// &harness.physics.impulse_joints,
// &harness.physics.multibody_joints,
// )
// .ok();
state.snapshot = PhysicsSnapshot::new(
harness.state.timestep_id,
&harness.physics.broad_phase,
&harness.physics.narrow_phase,
&harness.physics.islands,
&harness.physics.bodies,
&harness.physics.colliders,
&harness.physics.impulse_joints,
&harness.physics.multibody_joints,
)
.ok();
if let Some(snap) = &state.snapshot {
snap.print_snapshot_len();

View File

@@ -411,7 +411,7 @@ Hashes at frame: {}
serialization_time.as_secs_f64() * 1000.0,
timestep_id,
bf.len() as f32 / 1000.0,
format!("{:?}", hash_bf).split_at(10).0,
format!("{hash_bf:?}").split_at(10).0,
nf.len() as f32 / 1000.0,
format!("{hash_nf:?}").split_at(10).0,
bs.len() as f32 / 1000.0,