+1 vote

Solved: Just adding a raycast2d to detect walls and not use the collider OnWall()

Starting a project both Unity and Godot has the same issue (my fault :D ). My problem is, when I jump when I am touching a wall, then press jump, cuts/teleports to the next position. Doesn't move smoothly.

I am using the State machine finite. If velocity.y < 0 (Jumping) and touching a wall, change to WallJump state

// In the Player.cs
// In the _PhysicsProcess() is velocity = moveandslide(velocity)
public void Movement() {
// Move LR
Vector2 tmp_v = new Vector2();
tmp_v.x = Input.GetActionStrength("Move_Right") - Input.GetActionStrength("Move_Left");

velocity.x = tmp_v.x * SPEED;

// In the WallJumpState.cs
void _PhysicsProcess(){

Movement(); // From Player.cs ----^

if (IsOnWall() && !IsOnFloor())
    wallSliding = true;
    wallSliding = false;
if (wallSliding)
    velocity.y = Mathf.Clamp(velocity.y, -500F, -30F); // Slow fall

if (wallSliding && Input.IsActionJustPressed("Button_A") )
    velocity.x = -velocity.x * 2; // HERE, doen't move smooth, it cuts/teleports to the next place.
    velocity.y = -JUMPFORCE;

if (!IsOnWall())
    return fall;
if (IsOnFloor())
    return idle;
Godot version 3.5
in Engine by (37 points)
edited by

Please log in or register to answer this question.

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 Frequently asked questions and 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 [email protected] with your username.