Skip to content

Commit

Permalink
Add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aevyrie committed Aug 10, 2024
1 parent 008839c commit f169b58
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/reference_frame/propagation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ impl<P: GridPrecision> ReferenceFrame<P> {
// Optimization: we don't need to recompute the transforms if the entity hasn't
// moved and the floating origin's local origin in that reference frame hasn't
// changed.
//
// This also ensures we don't trigger change detection on GlobalTransforms when
// they haven't changed.
//
// This check can have a big impact on reducing computations for entities in the
// same reference frame as the floating origin, i.e. the main camera. It also
// means that as the floating origin moves between cells, that could suddenly
// cause a spike in the amount of computation needed that frame. In the future,
// we might be able to spread that work across frames, entities far away can
// maybe be delayed for a frame or two without being noticeable.
if frame.local_floating_origin().is_local_origin_unchanged()
&& !transform.is_changed()
&& !grid.is_changed()
Expand Down

0 comments on commit f169b58

Please sign in to comment.