mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-21 23:54:23 +00:00
Use slide instead of bounce for collisions
This commit is contained in:
parent
b580dfd65e
commit
6c3bfb3bf8
1 changed files with 1 additions and 3 deletions
|
@ -29,7 +29,5 @@ func better_move_and_collide(movement: Vector2):
|
||||||
collided_once.emit(collision)
|
collided_once.emit(collision)
|
||||||
# Determine the normal of the collision (the direction the body should be pushed back in)
|
# Determine the normal of the collision (the direction the body should be pushed back in)
|
||||||
var collision_normal = collision.get_normal()
|
var collision_normal = collision.get_normal()
|
||||||
# Change the velocity adequately
|
|
||||||
velocity = velocity.bounce(collision_normal)
|
|
||||||
# Reflect the remaining movement
|
# Reflect the remaining movement
|
||||||
movement = collision.get_remainder().bounce(collision_normal)
|
movement = collision.get_remainder().slide(collision_normal)
|
||||||
|
|
Loading…
Reference in a new issue