Externalize calculation of frame delta from move_and_slide()
as a required velocity parameter (Godot 4)
#9663
Labels
move_and_slide()
as a required velocity parameter (Godot 4)
#9663
Describe the project you are working on
A multiplayer 3D RTS game that uses differing tick rates for different objects
This issue was already raised here #1192, but much of the discussion is about Godot 3's
move_and_slide
which allowed passing of velocity as a parameter. In contrast, Godot 4'smove_and_slide
does not accept any parameters, which causes this issue.Describe the problem or limitation you are having in your project
Minimal reproduction project
It is impossible to use
move_and_slide
in a deterministic way because it multiplies by frame delta internally - which forces floating point math to be usedIn contrast, modifying a Node's position manually or using
move_and_collide
can be done without any floating point math because frame delta is not consideredImagine a project with this setup:
move_and_slide
on every physics frame as normal - no issuesmove_and_slide
every 10th physics framemove_and_slide
velocitymove_and_slide
multiplies the character's velocity internally, small floating point errors will be introduced between the important and unimportant objects - which will eventually manifest as desynced positionsDescribe the feature / enhancement and how it helps to overcome the problem or limitation
Remove frame delta calculations from
move_and_slide
:move_and_slide
move_and_collide
doesDescribe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
move_and_slide
as described abovemove_and_slide
as follows:If this enhancement will not be used often, can it be worked around with a few lines of script?
No
Is there a reason why this should be core and not an add-on in the asset library?
move_and_slide
is a core engine functionRelated
move_and_slide()
should not implement delta on its own #1192The text was updated successfully, but these errors were encountered: