#Player physic's are acting really weird

1 messages · Page 1 of 1 (latest)

charred herald
#

This video shows off what is happening (alongside some details for it all). I didn't change the script for the player at all (here it is below). How should I fix it or get more details on how to debug it?



const SPEED = 300.0
const JUMP_VELOCITY = -400.0


func _physics_process(delta: float) -> void:
    # Add the gravity.
    if not is_on_floor():
        velocity += get_gravity() * delta

    # Handle jump.
    if Input.is_action_just_pressed("ui_accept") and is_on_floor():
        velocity.y = JUMP_VELOCITY

    # Get the input direction and handle the movement/deceleration.
    # As good practice, you should replace UI actions with custom gameplay actions.
    var direction := Input.get_axis("ui_left", "ui_right")
    if direction:
        velocity.x = direction * SPEED
    else:
        velocity.x = move_toward(velocity.x, 0, SPEED)

    move_and_slide()```
cedar cape
#

You seem to have a second player script in your sprites folder. Could that be the source of your problem?

charred herald
cedar cape
#

Is it the wobbling that's the problem?
It looks to me like you have camera smoothing enabled and your game is low res. So as camera does small motions, it moves in pixel-sazed intervals
If you added icon.svg as a sprite in the scene, you would probably see the problem

charred herald
cedar cape
#

Your character moves. You simply have no reference to see the motion when the camera does not lag behind

charred herald
cedar cape
#

You added it to the node tree as a child of the player. It position gets updated relative to the player

charred herald
cedar cape
#

While you are at it, you added camera as a child of the instance of the player scene, not inside of the player scene

cedar cape
#

Good luck