Skip to content
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

Parallax layers offseting #4

Open
schizabardak opened this issue Feb 9, 2024 · 6 comments
Open

Parallax layers offseting #4

schizabardak opened this issue Feb 9, 2024 · 6 comments

Comments

@schizabardak
Copy link

Hey, thanks for the plugin. I have a question: is the script supposed to offset the parallax layers if the camera is not at the 0, 0 position at the beginning of the game? One of the main problems of the old parallax system (bug) is this precise effect because it moves all of the parallax layers to the side from their intended positions in the scene editor.

@nklbdev
Copy link
Owner

nklbdev commented Feb 10, 2024

Hello!
The plugin, while working in the editor, moves the parallax layers as it happens in the game. Therefore, their coordinates change. This cannot be avoided.

Therefore, at startup, it must initialize these coordinates with the MotionOffset value

If you disable the plugin in editor mode and manually move the layers, their position will be reset when the game starts. Please keep this in mind.

P.S.:
Oh, sorry. Sometimes I talk in terms of my second parallax plugin - PreviewingParallaxBackground. It works in exactly the same way, but is intended for more specialized case. I hope you understood what I meant.

@schizabardak
Copy link
Author

schizabardak commented Feb 12, 2024

Thanks for the response. I had misunderstood how I should approach the plugin at the beginning but now it works perfectly (at thirst I thought the parallax was offsetting from the initial camera position and not from the 0, 0 mark). However, I've observed a different issue: when I arrange all of my layers with parallax preview mode turned on and run the project in windowed mode (say 1920x1080 or any other 16:9 res) everything works correctly and looks exactly like in the editor. But when I run the same project in fullscreen, all of my parallax layers change positions ever so slightly even though I have kept the aspect ratio in my window settings (I've also tweaked the settings but nothing seems to fix the problem; e.g. changing the stretch scale makes this additional offset even greater in fullscreen mode). The screen on my computer is 2560x1440.

Could you please guide me on what I am doing wrong and how to possibly fix the issue?

P.S. I forgot to add that I was talking here about your new parallax 2d class and not the old ParallaxBackground node with an added preview mode.

@nklbdev
Copy link
Owner

nklbdev commented Feb 12, 2024

Thank you, this is a very valuable observation!

Please take screenshots or better record a video of this effect.

If possible, log the obtained coordinates of the camera and parameters of the Parallax node. This will help a lot with debugging!

P.S.: I also use a monitor with this resolution, and have not yet observed such an effect.

@schizabardak
Copy link
Author

schizabardak commented Feb 12, 2024

I've made a short demo showing the effect in action. You can clearly notice the difference in the behaviour of the three parallax layers between windowed and fullscreen modes in the attached videos: https://we.tl/t-U9yd2yxSUs (note that the red arrow's (player) initial position is 0, 0 in both videos)

Haven't prepared the log files so sending you the whole project: parallax_offset_test.zip

@nklbdev
Copy link
Owner

nklbdev commented Feb 13, 2024

Thank you! This will help a lot.
Excuse me, I'm very busy. I can only devote time to your ticket on the weekend.

@schizabardak
Copy link
Author

No prob, thanks a lot for looking into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants