1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-21 07:34:22 +00:00

Use slide instead of bounce for collisions

This commit is contained in:
Steffo 2024-04-29 05:50:49 +02:00
parent b580dfd65e
commit 6c3bfb3bf8
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0

View file

@ -29,7 +29,5 @@ func better_move_and_collide(movement: Vector2):
collided_once.emit(collision)
# Determine the normal of the collision (the direction the body should be pushed back in)
var collision_normal = collision.get_normal()
# Change the velocity adequately
velocity = velocity.bounce(collision_normal)
# Reflect the remaining movement
movement = collision.get_remainder().bounce(collision_normal)
movement = collision.get_remainder().slide(collision_normal)