Change orthographic projection near default to -1000 #12621
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Fix an issue where
Camera2dBundle
andOrthographicProjection
have different defaults for the projection'snear
value. This causes confusion when a user starts with:and decides they need to modify just one field of the projection:
Since the user never mentioned the
near
field, it is surprising that thenear
field changes (from-1000.
to0.
).This issue was the inspiration for #11115.
Fixes #12267
Solution
This behaviour was introduced in #9310, which changed
Camera2dBundle::default()
to cover the regionz=-1000.
toz=1000.
(so that sprites with negative Z are visible) and place the camera at the origin. This PR changesOrthographicProjection
to have the same defaults asCamera2dBundle
.At the time,
Camera2dBundle::new_with_far
was not touched, since that would be a breaking change for that function, since that function is fairly explicit about the near/far range. This PR keepsnear=0
in that function.Changelog
near
plane forOrthographicProjection
.