Need advices on collision detection and wall jumping

Godot Version

4.4.1

Question

Hi everyone,

I am new to game development and try to make a 2d platformer basic game for learning purpose and need advices, tips and pointers.

First thing, I was wondering what is the most optimal technic for detecting collision and make nice controller :

  • Player on the ground
    • I am using IsOnFloor() method with MoveAndSlie(), but is lagging and buggy
  • Corner cutting (push off edge) when jumping
    • I was thinking of using multiple ray cast but the check will be expensive for the process
  • Collision shape is 50% off the corner to make the player fall
    • I was thinking of expending the raycast system for the corner cutting
  • Wall with special attribute (custom data in a tilemaplayer)
    • I am looking for collision with raycast

The second thing, is very specific, I create a sticky wall where my player can perform wall jump, and when the player jump on the wall, the player slide down. When the player press the reverse direction of the wall, the player fall (fall state). When the player jump from the slide position (only press jump and no direction), I make the character move on the x, y axis and flip the facing direction. My problem, is when the player is on the wall and hit the input direction reverse to the wall and then press jump, the character fall before and the jumps is done in the air. The feet of the player are going through the wall and don’t feel snappy or natural. I try many things, none make me happy. I want to keep a way to drop from the wall, and make the jump natural like it hit the wall. Maybe someone have an idea?

Thanks in advance for your help!

Not sure what exactly you mean that IsOnFloor() method with MoveAndSlide() is lagging and buggy… But, for applying gravity I would do it always and not only when the player is on the floor, this can prevent issues with is_on_floor function returning false when the player is still on the floor… Couldn’t find in the docs but sure it’s in there somewhere.

Can you share your controller code?