-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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 optional delta parameter to move_and_slide #84665
base: master
Are you sure you want to change the base?
Add optional delta parameter to move_and_slide #84665
Conversation
This overrides the implicit delta derived from context that is currently being used. If not passed, the method functions as it normally does. This change allows finer control over the method's behavior without sacrificing ease of use.
Thank you for your contribution! You need to add the new parameter to the documentation, use |
Done. My bad for missing that part 😅 |
What happens when |
Fair enough. Should I just make the default 0.0? |
I think |
Should probably document that passing non-positive delta leads to unexpected behavior |
That it uses the default one yes, that it ignores it, not necessarily unexpected behaviour, should be clear what it does |
Also add a note to the docs about the behavior when delta is <= 0
Might want to change the check to Will do more style and detail review later but will leave for testing for right now, can test and investigate when I have more time |
Why is that? In the current docs I see examples of both |
Unsure, it's stripped by the generator I think, which is an issue, can't find it right now though Edit: might have updated since then, had it backwards in any case |
Also fix documentation of delta param
The current thing that's failing is compatibility related, a bit of a complex thing to add so no rush with that right now, will guide you through it when reviewers have gone through the feature itself |
This doesn't sound sufficient on its own to perform rollback. If you're catching up with server lag, performing |
Thanks :D |
It's not sufficient on its own, but it's still a necessary step to be able to use
Technically, this is a separate issue from being able to step the physics engine, even if they're related to the same use case, so it made sense to me to raise a separate PR for it.
PS: just to be clear, the comment this PR refers to doesn't allude to performing move_and_slide once with a really large delta. It refers to performing it once per physics frame with a fixed delta, but having the engine tick faster, so that the client actually simulates the game faster and sends inputs to the server at a higher frequency when the server signals that it is being starved |
With this PR, multiple simulation steps for character movement could be easily implemented by just calling move_and_slide() multiple times in a for loop, with smaller delta, no? |
@monitz87 I thank you for this contribution, glad to see this feature is finally getting added after the over 2 years of discussion about it in issues! Been banging my head against a wall trying to figure out why I was getting constant desyncing in my netcode to find that move_and_slide was the culprit. |
This overrides the implicit delta derived from context that is currently being used. If not passed, the method functions as it normally does. This change allows finer control over the method's behavior without sacrificing ease of use.
Explanation for why this is necessary here
This is my first contribution to the project, so I apologize in advance if I botched something. I read the contribution guidelines but there's a chance I missed something