0 votes

Guys, I'm trying to migrate a project from 3.0.6 to 3.1.beta2 but I'm having a litte problem:
My game is a plataform game 2D and I use the following code to apply the gravity (the fall function its called on _physics_process(delta):

func fall(delta):
    if  is_on_floor() or is_on_ceiling():
        motion.y = 0
    else:
        motion.y += GRAVITY * delta

It works fine on 3.0.6 but not in 3.1.beta2. In 3.1, when the player colides with a ceiling, he gets stuck in tge ceiling.

I even tried removing the motion.y = 0 but doesn't really matter the motion.y value, if the player touches the ceiling, he will get stuck.

If you want to try in your computer, here is the project on GitHub

in Engine by (519 points)

2 Answers

0 votes
Best answer

I fixed removing the else and putting motion.y += GRAVITY * delta outside the if. I really don't know why it's doing that on 3.1 but removing the else was the only solution I could find.

by (519 points)
0 votes

I figured out a curious solution before seeing here that this a bug:
I converted constant "UP" to a variable value so when "isonceiling" is "true" i inverted the second value from -1 to 1, making gravity upside-down...

by (14 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.