#GRAVITY NOT WORKING
12 messages · Page 1 of 1 (latest)
What is the value of gravity?
im not sure i dont see that. I dont have gravity defined as anything in the script that works either. Does the get.setting not get that?
Try to print gravity in physics process and check.
Should be a valid value, but could be wrong.
its giving 980
Neither the move_and_slide() or move_and_collide() functions is ever called within the physics process callback. Using one of these two methods is how you would normally use the CharacterBody2D to calculate velocity vectors and collisions to tell if it's on the floor. You also shouldn't change it's position directly as this will cause unintended results with the physics and collision detection.
Of course; good catch @spring lagoon!
How would i use these? im a super beginner so i dont know code yet
At the very end of your _physics_process(delta) function, add this (on its own line, and not under the velocity.y line):
move_and_slide()
And as burgundy said, you shouldn't modify the position directly, unless you're teleporting your character or something.
replace that last line's "position.x" with "velocity.x"
when i do this, the gravity works but they no longer move around like before