-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Background Parallax #96
Comments
Take a look at how the bevy-parallax crate achieves its horizontal parallax effect: https://github.com/Corrosive-Games/bevy-parallax/blob/main/src/lib.rs#L65 There's not much to it. The background is following the camera, moving by some scale offset by a multiplicative factor. Now, I can't just reuse the same If I could somehow get the distance moved by the camera/player since the last update, then I could shift the background by this amount multiplied by a scaling factor... We could use an event to communicate that information. But do we need to get the distance change? Can't we just divide the distance from the origin by a scaling factor and this... should be good for all possible distances? new_pos = camera_pos * parallax_factor // where parallax_factor is in the range 0.0...1.0 A factor of 1.0 would appear to be fully static (matching the ship and camera) and a factor of 0.0 would appear to match the star and planets (the resting frame). So consider adding a That works... but only for static layers. It may be a worthwhile future exercise to consider how this might be achieved for layers that contain objects in motion. |
Related: Issue #85 + PR #95
As part of an effort to upgrade to Bevy 0.12, I have removed bevy_tiling_background which was previously responsible for...
This parallax effect is now absent, and we should seek to reimplement it... somehow.
The text was updated successfully, but these errors were encountered: