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

KinematicBody2D (Ball) Stutters and Jumps even when only object in scene. #17246

Closed
AdventurousDrake opened this issue Mar 4, 2018 · 5 comments

Comments

@AdventurousDrake
Copy link

Godot version: 3.0.1

OS/device including version: Windows 10 Home, Nvidia GTX980 (Driver Ver. 391.01)

**Issue description: KinematicBody2D
I just have a ball bouncing around, no other graphics and the ball stutters and sometimes jumps forward in the direction it is moving. Is this an engine bug? I am using KinematicBody2D, Sprite and CollisionShape2D (Circle). Doesn't seem to matter whether I am using #_physics_process(delta) or _process(delta).

I did also code it directly with position += direction * speed * delta, and it was better, but still jumping, but less stuttering. (Compared to move_and_slide which I have now(is worse))

PS. This is my first time to do this, so please contact me if you need more info, Thanks DS**

**Steps to reproduce:

  1. Please run code, or executable.

  2. See if the ball is stuttering and occasionally jumping in the movement direction, happens quite often, jumping is smaller or bigger but is more arbitrary, should happen within a minute**

**Minimal reproduction project:
Ball Performance Test Project.zip

test ball performance executable.zip**

@eon-s
Copy link
Contributor

eon-s commented Mar 4, 2018

I cannot see the code or project settings because the examples are compiled, in any case, looks like a duplicate of the old #2043

@AdventurousDrake
Copy link
Author

Yeah it seems to be the same problem, unfortunately I couldn't find that topic when I searched for KinematicBody2D or I missed it.

I turned off vsync in the project settings, that helped, so it's ok 90% of the time. I've also read that it could maybe be fixed in Godot 3.1. Any release date for it yet?

Here is the project, I hope one can read the code now. (If it is still of interest)
Ball Bouncing Test Project.zip

Thanks

@eon-s
Copy link
Contributor

eon-s commented Mar 4, 2018

No ETA for 3.1, and not sure if the work on the physics frame interpolation has started yet (and there are other camera improvements too that may help on this).

Oh, and try adding a background image, sometimes the effects is seen worse over the clear color than with a background texture.

@Srekel
Copy link

Srekel commented Mar 16, 2018

I get jitter with a fairly small example:
`extends KinematicBody2D

var velocity = Vector2(0,0)

func _ready():
set_physics_process(true)

func _physics_process(delta):

var right_input = Input.is_action_pressed("right")
var left_input = Input.is_action_pressed("left")
velocity.x = 0
if right_input:
	velocity.x =150
if left_input:
	velocity.x = -150

move_and_slide(velocity, Vector2(0, -1))

`

I recorded a video with OBS and on most frames, my "Player" node moves the same distance, but on a few frames, there is no movement. Presumably this is because sometimes two frames get rendered between two calls to _process I guess. I've set the physics frame rate to 120 but it didn't help.

2018-03-16 12-30-24.zip

So yeah, seems like interpolation is needed. :)

@Calinou
Copy link
Member

Calinou commented Jun 7, 2020

Duplicate of #10388. Try installing and enabling lawnjelly's smoothing add-on to get physics interpolation in your project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants