-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
[GodotPhysics] KinematicBody3D with move_and_slide() move bumpy/jittering on flat surface #45060
Comments
While the bug isnt solved in general, I could solve this problem in my project, so I recommend this to you: Option 1:
Option 2:
|
Thanks for your suggestions ❤ Option 1: I think it's too complicated as a solution. Therefore I put a condition before applying the gravity instead. Since GodotPhysics does a reliable job to detect the floor with is_on_floor(), unlike the current Bullet engine which is known to have this kind of issue, i.e. #33833 or #45058. Moreover, testing whether the body is on the floor before applying gravity makes the falling of the body be more simple to implement and more natural, as the gravity value will be interpolated by the physics instead of being at the maximum value all the time. Option 2: I tried the smoothing-addon but it didn't help at all. I believe this issue is not relating to the jittering from the un-alignment of the PhysicsRep and VisualRep, which the addon is trying to solve. If you watch the issue closely, you will see that the y translation of the cube changes its position while being moved on a flat surface. It can only mean that there's a problem with how the physics work somehow. |
You forgot to assign the result of "Move and slide" to the velocity. For the record I added the GDScript version (with the fix). extends KinematicBody
var gravity = 50.00000
var gravity_max = 100.0000000
var speed_acceleration = 50.00000
var speed_max = 100.00000
var velocity = Vector3(0,0,0)
func _physics_process(delta):
gravity_pull(delta)
player_velocity(delta)
velocity = move_and_slide(velocity, Vector3.UP)
func gravity_pull(delta):
velocity.y = clamp(velocity.y - delta*gravity, -gravity_max, gravity_max)
func player_velocity(delta):
velocity.x = clamp(velocity.x + delta*speed_acceleration, -speed_max, speed_max)
func _input(event):
if(Input.is_action_pressed("ui_select")):
velocity.y = 30
|
Godot version:
OS/device including version:
Issue description:
I move a KinematicBody3D with velocity input to the move_and_slide() using the GodotPhysics engine. It has a bumpy ride on a completely flat floor(StaticBody), as shown in my screen recording below:
2021-01-09.19-31-11.mp4
Steps to reproduce:
Minimal reproduction project:
test.zip
The text was updated successfully, but these errors were encountered: