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 spanning 3 collision blocks causes Y jitter #40498

Closed
chucklepie opened this issue Jul 18, 2020 · 2 comments
Closed

KinematicBody2D spanning 3 collision blocks causes Y jitter #40498

chucklepie opened this issue Jul 18, 2020 · 2 comments

Comments

@chucklepie
Copy link

Godot version:
3.2.2 stable (on linux, gles3)

Issue description:
I have a tilemap and a kinematicbody2d. The code, as below, simply applies a downward y velocity and calls move and slide. When walking y velocity is 0. However, when the kinematic body spans 3 collision tiles then every other frame changes y velocity toggles between 0 and 5.166667 continuously. As soon as the kinematic body only spans 2 tiles y becomes 0.

Image below shows the body spanning 3 tiles and as stated y jitters in this position.

image

The code is as follows, inside _physics_process:

func move_player(delta):
	velocity.y+=Globals.GRAVITY*delta
	velocity.x=lerp(velocity.x,MAX_SPEED*direction,_get_h_weight())
	velocity=move_and_slide(velocity,Globals.UP)

I did notice a similar fault raised, but this is for a 3D object
#35780

@Calinou
Copy link
Member

Calinou commented Jul 18, 2020

@chucklepie Please upload a minimal reproduction project to make this easier to troubleshoot.

@pouleyKetchoupp
Copy link
Contributor

Fixed in #42574, closing.

@Calinou Calinou added this to the 4.0 milestone Jan 15, 2021
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

3 participants