You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on creating a follow-up response to you regarding the PR I proposed a few months ago.
In attempting to recreate my issue I realized that I was experiencing confusion due to an unexpected example.
This is the code that is currently used to generate a visually pleasing square of squares:
let n = 20;
let spacing = 50.;
let offset = spacing * n as f32 / 2.;
let custom_size = Some(Vec2::new(spacing, spacing));
for x in 0..n {
for y in 0..n {
let x = x as f32 * spacing - offset;
let y = y as f32 * spacing - offset;
let color = Color::hsl(240., random::<f32>() * 0.3, random::<f32>() * 0.3);
commands.spawn(SpriteBundle {
sprite: Sprite {
color,
custom_size,
..default()
},
transform: Transform::from_xyz(x, y, 0.),
..default()
});
}
}
This square appears approximately in the center of the screen, but it's not true center. This is because we're spawning multiple sprites, rather than one large sprite, and each sprite is being added with the default center anchoring.
Here we generate a square which is the same dimensions and spawn it at 0,0 with a center anchor.
Visually, here are the outputs:
and we see that these two squares, while taking similar dimensions, have varying alignment. I find this to be extremely confusing given the context of attempting to verify the efficacy of boundary clamping.
I would expect that if I set projection.scale = 1.0 / (viewport.width / (spacing * n as f32)) that the square would be centered, but it is slightly off center, which gives the impression that potentially something is going awry with bounding logic.
The text was updated successfully, but these errors were encountered:
Hello! :D
I am working on creating a follow-up response to you regarding the PR I proposed a few months ago.
In attempting to recreate my issue I realized that I was experiencing confusion due to an unexpected example.
This is the code that is currently used to generate a visually pleasing square of squares:
This square appears approximately in the center of the screen, but it's not true center. This is because we're spawning multiple sprites, rather than one large sprite, and each sprite is being added with the default center anchoring.
In contrast, consider this code:
Here we generate a square which is the same dimensions and spawn it at 0,0 with a center anchor.
Visually, here are the outputs:
and we see that these two squares, while taking similar dimensions, have varying alignment. I find this to be extremely confusing given the context of attempting to verify the efficacy of boundary clamping.
I would expect that if I set
projection.scale = 1.0 / (viewport.width / (spacing * n as f32))
that the square would be centered, but it is slightly off center, which gives the impression that potentially something is going awry with bounding logic.The text was updated successfully, but these errors were encountered: