godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.12k stars 69 forks source link

Ability to control position smoothing speed for the X and Y axis individually in the Camera2D Node #10468

Open VincentShao32 opened 1 month ago

VincentShao32 commented 1 month ago

Describe the project you are working on

I'm making a 2D platformer/metroidvania which uses specific camera movements.

Describe the problem or limitation you are having in your project

When applying a new vertical limit to the camera, I want it to smoothly and slowly move to be within the limit without slowing the smoothing on the horizontal axis. I saw that I couldn't do this with Godot's built in functionalities, so I wrote a custom smoothing script to solve this problem. However, I think being able to control smoothing speed on different axes independently can be useful in other situations and should be a built-in feature.

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

The new feature is letting us control position smoothing speed for the camera for the X and Y axis individually. This way, the camera's smoothing speed could be reduced on the Y axis but kept the same for the X axis, solving the problem I had earlier. This also gives more flexibility to the smoothing capability of the camera.

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

When editing the smoothing speed, instead of having one value like it is now, there will be two. One for controlling smoothing speed on the X axis, the other for the Y. Now, when the camera is smoothing, it will use one value for horizontal movement and the other for vertical.

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

It can be, but that means I can't use the built in smoothing functionality at all and have to implement everything related to smoothing myself. This defeats the purpose of having a smoothing funcitonality in the first place.

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

This will improve the Camera2D nodes capability out of the box.

Calinou commented 4 weeks ago

This proposal is more specific though, so I'll leave it open.

VincentShao32 commented 4 weeks ago

Hi, I completed my implementation and made a pull request. Here's the link: https://github.com/godotengine/godot/pull/95717

Would love it if you could review it for me, thanks!