Godot Version
Godot 4.6
Question
Player clips into floor when dashing.
When the player dashes, his collision mask is halved in height and once its done, it goes backto its original size but this makes him clip into the floor. Is there a way to fix that?
# dash
if raw_input and velocity.x and dash and not dashing or (is_on_ceiling() and is_on_floor()):
dashing = true
velocity.x += dash_speed * raw_input.x * delta
acceleration = 50
_dash_timer.start()
if _dash_timer.is_stopped() and not (is_on_ceiling() and is_on_floor()):
acceleration = 20
dashing = false
if dashing:
_collision.shape.size.y = 0.8
else:
_collision.shape.size.y = 2.0
Move the shape down when dashing so its bottom face stays at the same elevation.
This causes the player to stop in place. I lower him to a height of 0.5 and his collision size goes from 2 to 1 but this stops his dash.
# dash
if raw_input and velocity.x and dash and not dashing or (is_on_ceiling() and is_on_floor()):
dashing = true
velocity.x = dash_speed * speed * delta
acceleration = 50
_dash_timer.start()
if _dash_timer.is_stopped() and velocity.x == 0.0 and not (is_on_ceiling() and is_on_floor()):
acceleration = 20
dashing = false
if dashing:
_collision.shape.size.y = 1.0
_collision.position.y = -0.5
else:
_collision.shape.size.y = 2.0
_collision.position.y = 0.0
I tried using move_to()which kinda works but Im still testing it
It works using Move_to(), at least as far as Ive tested it. Thx.