How to detect collisions between RigidBody2D and KinematicBody2D

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Giantpotato
:warning: Old Version Published before Godot 3 was released.

I have a ball instance that is a RigidBody2D and I want it to ‘activate’ a button. This button is a KinematicBody2D. I don’t think that the button should be a KinematicBody2D, but what do I know.

Any help would be greatly appreciated!

Can the button move? What does it do after it’s been activated?

DodoIta | 2017-06-03 10:01

:bust_in_silhouette: Reply From: eons

RigidBody2D can report collisions (contact monitor need to be enabled and set to more than zero) and you can get them via signal (body_enter) or checking on fixed process/custom integrator (get_colliding_bodies).

Then just just do something like getting the group of the object is touching (you can check the angle and other things to detect a correct trigger collision), if you identify it as a “button”, tell that button to do something.