#2DCharacterBody collision on each other

1 messages · Page 1 of 1 (latest)

rich briar
#

I'm trying to have it so when two players collide, they bounce off of each other( or knock the other back). I am using move and slide to move my characters.

#

currently, i'm stuck on trying to detect collisions. I have an area2D signal for each of the players just printing whether or not they detected a collision, and that does have an output, but this example code that I'm following to eventually grab the velocity of the collider isn't printing anything and I don't know what to do next

            var collision = get_slide_collision(i)
            print("Collided with: ", collision.get_collider().name)