Stick to animatable body from below

Godot Version

4.3

Question

I am creating a 2D platformer in which there are some moving platforms that move vertically. Currently, I have an AnimatableBody2D as the type of the plaform. This works perfectly well when the player is on top of the platform. But in my game, the player will have the ability to invert gravity. When inverting gravity, I am setting the y scale of everything to -1 and “overriding” get gravity, is on floor and is on ceiling functions. It seems to work well of all other purposes but in this case, I need the player to stick to the underside of the moving platform and he doesn’t.

Example video: elevator_bug_demo

Any idea how I can get him to stick to the platforms from both sides? While still using AnimatableBody’s features?

I fixed it by besides setting scale.y to -1 when inverting, instead of overriding get_floor() and get_ceiling() I simply changed the up direction parameter to point down instead. This also affects how the player attaches to the animatable body, thus solving this issue

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.