0 votes

As seen within the example, the player bounces back during the tree trunk collision. Due to permanent player input (against the trunk), the KinematicBody2D repeats its behaviour.

For the player I use a KinematicBody2D with following code:

var src = _movement * speed
var dest = acceleration

if src == Vector2.ZERO:
    dest = friction
if _force != Vector2.ZERO:
    _force *= (1.0 - (1.0 / friction)) * 0.9
    if _force.length() <= 0.5:
        _force = Vector2.ZERO

_velocity = move_and_slide(_velocity.move_toward(src, dest) + _force)

_force is Vector2.ZERO, as I only use it for external force input.
_movement indicates a normaized value on both axis.

Example 1
Example 2

The trunk is a part of the tilemap, whereas a collision shape (in this particular case a square) has been set up for it. I do wonder why the player bounces back, even thought the tilemap has no "surface softness" definition, nor the kinematicBody has.

Godot version 3.2.3.stable.official
in Engine by (28 points)
recategorized by

reducing the acceleration from 800 to 40 fixes the issue. However, then the movements feel unnatural.

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 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 webmaster@godotengine.org with your username.