Collision detection on RigidBody2D

Arek900704Arek900704 Posts: 1Member

Hi, I have same problems with detection collision between RigidBody2D and KinematicBody2D. On Rigid I have set Contact Monitor as ON and Contacts Raported as 10.

The code

var bodies = get_colliding_bodies()
    print(bodies)

retiurn null although in the same time code from KinematicBody2D

if (is_colliding()):
        print(get_collider())

return

[RigidBody2D:631]

What I have to do to have detection on RigidBody? Please help :)

Answers

  • indicainkwellindicainkwell Posts: 9Member

    Hi! With get_colliding_bodies() you'll still have to check if it is_colliding(), because bodies aren't necessarily colliding every frame.

    It may also be more convenient to use the body_enter signal to do some processing on each body that enters (or exits with body_exit).

Sign In or Register to comment.