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

Built-in jumping/falling lookahead for 2D? #228

Open
elvisish opened this issue Mar 7, 2024 · 5 comments
Open

Built-in jumping/falling lookahead for 2D? #228

elvisish opened this issue Mar 7, 2024 · 5 comments

Comments

@elvisish
Copy link

elvisish commented Mar 7, 2024

Project Type

2D

Feature Description

Is it possible to have a built-in lookahead distance for jumping and falling that adjusts depending on the falling and jumping speed? I believe it can be done currently by manually adjusting the Follow Target Offsets depending on the Y velocity, but it would be very useful to have it out-of-the-box for a lot of 2D games.

Use Cases

If the character is falling pretty fast or jumping/springing quickly, this would ensure the player doesn't leave the screen.

Importance

Low - there are workarounds where the proposed feature would just simplify things

Usage

Often - a significant amount of projects can find this useful

(Optional) Proposed Solution

No response

@ramokz
Copy link
Owner

ramokz commented Mar 7, 2024

It's not a built-in feature at the minute, but there are plans for implementing it.

There is an existing PR for that, with an explanation for how it ought to work.
TLDR; the velocity of the follow target would offset the camera in the direction the target is moving.

@elvisish
Copy link
Author

the velocity of the follow target would offset the camera in the direction the target is moving.

Yep, it should also maintain the same distance depending on velocity (so super fast falling, jumping or running doesn't allow the tweening camera position to lag behind).

@elvisish
Copy link
Author

elvisish commented Jan 9, 2025

Is look-ahead still planned? The original PR seems to be closed/deleted: #160 (comment)

@ramokz
Copy link
Owner

ramokz commented Jan 9, 2025

Short answer, support is still planned.

That PR you linked to was closed as it was based on a hardcoded lookahead value, whereas the behavior should ideally be dynamic based on the target's velocity instead; with some parameters around that.

Another PR (#284) also aimed at implementing it, but that PR has, at this point, likely been abandoned by the author.

Am personally caught up with more fundamental changes / improvements to the addon, so it's not at the top of my todo list atm.

@elvisish
Copy link
Author

elvisish commented Jan 10, 2025

Short answer, support is still planned.

Great, I think it's also important to note that look ahead should be factored into framed mode. Currently if you're using framed, the player is offset from the center of the screen by the framed dead zone amount, which makes it difficult to see enemies for the sake of having the camera move a bit later. The same goes for slow lerp speeds. Look ahead should always be the last thing calculated so it can be used to effectively recenter the player (or even offset them negatively from the center for even better visibility ahead).

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