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.
Short summary:
FollowCamera
Why?
FollowCamera.Follow(...)
andSetCenteredDeadzone
did not position the deadzone in the center of the screen, if a camera zoom is used.So?
I modified the FollowCamera to fit my Zooming-Needs and maybe this is a good general addition.
Whats new?
The Deadzone can now be set in
FixedPixel
or inScaledCameraBounds
.1)FixedSize:
Is almost like the old behavior, but the Deadzone now stays at the same place on the screen, even when zooming.
(instead of flying over the screen)
Fixed.mp4
2)ScaledCameraBounds:
Deadzone size is defined in % of CameraBounds. For Example
SetCenteredDeadzoneInScreenspace(0.5f, 0.5f)
will let the Deadzone always fill the inner 50% of the screen, regardless of Camera Zoom.Scaled.mp4
What changed for developers when they ... ?
FollowCamera.Follow(...)
: Works as before, but now also positions the Deadzone in the Screen-Center if zoomed.FollowCamera.SetCenteredDeadzone
: (same as above)Deadzone
directly: Breaking Change the origin of the Deadzone is now in the Center of the camera instead of top-left. So anew Rectangle(-5, -5, 10 10)
is now positioned in the center of the screen instead of top-left of the screen