hi there i have this bug where gravity would only take into effect when animation finishes. in the console it is currently printin the variable self.ground_contact which is true when touching the tile map and false when its not how can i fix this.
hi there i have this bug where gravity would only take into effect when animation finishes. in the console it is currently printin the variable self.ground_contact which is true when touching the tile map and false when its not how can i fix this.
I would start by looking at the collision shapes. Are they really where you expect them to be?
yep the colision boxes are where the are meant to be but for some reason it only knows it dosent touch an object after the animation is completed
Are you sure about your logic for applying gravity and setting/clearing ground contact? What does the code look like?
player script.script (3.6 KB)
gravity only takes into effect when the character is not touching the ground but it only detects thats its not touching the ground after the animtions are compelted
I do not spot anything that could cause this behavior in the script you attached. Perhaps you can share the entire project?
the zip file is kind large due the the grahpics so i cannot share it here how can i share it
The player will only fall when self.ground_contact
is set to false
, but that only happens when:
- the player jumps
- the player script receives a message other than
contact_point_response
The message that’s triggering that second case appears to be animation_done
. That would explain why the player starts falling only when their animation finishes. You should have self.ground_contact = false
at the end of fixed_update()
so that the player is always falling whenever they’re not touching the floor.
the zip file is kind large due the the grahpics so i cannot share it here how can i share it
omg ur so big brain thanks !!!