Godot Version
4.6.3
Question
Hey there! I’m wondering on how I can check if a CharacterBody2D collided with the top or the bottom of another one(or any physics body in general)
Here’s my code:
func _physics_process(delta: float) → void:
velocity = direction * speed
move_and_slide()
for i in get_slide_collision_count():
var collision = get_slide_collision(i)
var collider = collision.get_collider()
if collider is CharacterBody2D:
collider.direction.x *= -1
#Depending on where the Body collided with another, the direction will be changed. But i just have no idea on how to figure that out.