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

Add camera smoothing #229

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

mrezai
Copy link
Contributor

@mrezai mrezai commented Jul 17, 2024

This PR adds camera smoothing to player.
PR sets as draft because by this implementation, animations in player's AnimationPlayer like jump doesn't work correctly and I'm not sure what is the best way to fix animations(tween, some formula in _physics_process ...).

Physics ticks per second = 30, monitor refresh rate = 120

Without camera smoothing:

rec1.mp4

With camera smoothing:

rec2.mp4

@mrezai
Copy link
Contributor Author

mrezai commented Jul 19, 2024

Camera animations fixed by add a new node named CameraHolder as parent of Camera and move transform interpolation to it.

@mrezai mrezai marked this pull request as ready for review July 19, 2024 08:06
@Phazorknight
Copy link
Owner

Hey, just getting around to checking this out.
I was wondering what case there is for reducing physics tics down to 30?

@mrezai
Copy link
Contributor Author

mrezai commented Jul 22, 2024

Hi, that config was only to show the effect better, physics tick hasn't changed in project.

@Phazorknight
Copy link
Owner

Hey, just wanted to follow up on this:
I'm hesitant in merging this, as this currently isn't fixing any issues or adding major new features.
The smoothing could be useful, but as it's setting nodes tied to player motion to top_level, fearing this could cause unexpected behaviour with other things.

Another thing is that Godot 4.3 announced to add 3d physics interpolation soon-ish, so we might have a engine-native solution soon as well.

@mrezai
Copy link
Contributor Author

mrezai commented Aug 15, 2024

Hi, it's OK to close this PR to prevent complication but I think even with builtin physics interpolation, camera should interpolated using a similar method to achieve best result. Godot 3.5 has physics interpolation and this is related document:
https://docs.godotengine.org/en/3.5/tutorials/physics/interpolation/advanced_physics_interpolation.html#cameras

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

Successfully merging this pull request may close these issues.

2 participants