0 votes

Hello everyone! How are you all doing?

This happens only when the characters is on a vertical moving platform. For horizontal movements everything is fine. I'm using a KinematicBody being moved by a moveandslidewithsnap function. All the margins are already set to 0.001. The platform is being moved by an AnimationPlayer set to Physics.


A GIF showcasing the issue:

Here's the player script:

extends KinematicBody

export var gravity = 3000

export var move_speed = 750

export var fall_multiplier = 1 
export var low_jump_multiplier = 10
export var jump_force = 1300
export var max_fall_speed = 3000

var y_velo = 0

var snap_normal = Vector3.DOWN setget set_snap_normal

func movement(delta):
    var move_vec = Vector3()
    if Input.is_action_pressed("move_left"):
        move_vec.x -= 1
    if Input.is_action_pressed("move_right"):
        move_vec.x += 1
    move_vec = move_vec.normalized()
    move_vec *= move_speed
    move_vec.y = y_velo
    move_and_slide_with_snap(move_vec * delta, snap_normal, Vector3.UP)

    var grounded = is_on_floor()
    y_velo -= gravity * delta

    if grounded:
        if Input.is_action_pressed("jump"):
            y_velo = jump_force
        if y_velo <= 0:
            y_velo = 0
    if y_velo > 0 and Input.is_action_just_released("jump"):
        y_velo -= 30 * (low_jump_multiplier)
    elif y_velo < 0:
        y_velo -= 7 * (fall_multiplier)

func set_snap_normal(new_snap_normal):
    snap_normal = new_snap_normal

func _physics_process(delta):
in Engine by (12 points)

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.