Using get_slide_collision() on rigid bodies?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Blogd

I have a kinematic body that uses get_slide_collision()
and i wonder if it registers rigid bodies as well
because when i collide with one it does not.
it works when i collide with an tilemap that has collision.

the code goes as follows: (inside the kinematic body 2D)

for u in get_slide_count():
var bodies = get_slide_collision(u)

if you want more code just ask me and i also have contact monitor set to true on the rigid body and contacts report are set to 2

Billy Lögdahl

:bust_in_silhouette: Reply From: kidscancode

This is explained in the docs for move_and_slide():

If infinite_inertia is true, body will be able to push RigidBody2D nodes, but it won’t also detect any collisions with them. If false, it will interact with RigidBody2D nodes like with StaticBody2D.

Documentation link