Skip to content

Add more versatility to Parallax2D nodes for making individual depth-based objects #13539

@Firch

Description

@Firch

Describe the project you are working on

A top-down side-scroller.

Describe the problem or limitation you are having in your project

I want to utilize Parallax2D nodes inside their own objects to create objects with depth.

Let's say we have some top-down environment, and we want to do an object that is supposed to represent very rudimentary top-down "pillar":

Image
1. The lower Parallax2D is in hierarchy, the lower its scroll_scale value is

Image
2. Only the camera is moved; the pillar itself is static

This is a pillar placed in the middle of the initial camera position. But now, lets add another one, at some other place:

Image
3.

As you can see, the parallax looks wrong: a properly working pillar would appear "straightened-out" towards the center of the screen.

This happens because Parallax2D currently accounts only for the motion of the camera, not for its original position.

Ideally in this situation, Parallax2D nodes should "predict" the offset based on the current position of the camera, where the offset would be invisible when the camera looks directly at it:

Image
4. "Fixed" version

Now let's say we need a little bit more wacky, moving pillar:

Image
5.

The new pillar appears somewhat wrong: this moving pillar doesn't account for the movement of itself, only to the movement of the camera.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Parallax2D should have a setting to:

  • Account for the original camera position;
    • This would solve the "object" problem, where an object is made out of Parallax2D nodes would stop appearing incorrectly in different places in the environment
  • Account for the relative (camera-to-parallax) position instead of just the camera motion.

I'm unsure on if these two features need to be two separate settings. In my example, they are related.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

If this enhancement will not be used often, can it be worked around with a few lines of script?

The first part of the issue I stumbled upon can be worked around by manually setting a script that would find the camera and apply relative offset to the parallax nodes based on the global position of both. Perhaps a similar workaround can be made to account for the motion.

Is there a reason why this should be core and not an add-on in the asset library?

The setting(s) is a core change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions