move_and_collide() not reporting collisions with RigidBody2D nodes

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

I have built a minimal example and I can’t get it to work with RigidBody2D nodes. It will report collisions with StaticBody2Ds and other KinematicBody2Ds

have a bullet that is on collision layer 2, with mask on 3

func _physics_process(delta):
var movement = direction * speed * delta
var collision = move_and_collide(movement)
if collision:	

I have set up 3 targets, all on collision layer 3, a Rigidbody2D a StaticBody2D and a KinematicBody2D.
If I fire at each of them in turn the bullet stops at both the Static and Kinematic and move_and_collide() returns a KinematicCollision2D object. In the case of the Rigidbody, the bullet hits and moves the RigidBody2D but move_and_collide() returns nothing.

Am I right in saying that move_and_collide() should return something when colliding with a RigidBody2D? The docs are not entirely clear on this point.

:bust_in_silhouette: Reply From: kidscancode

The docs are entirely clear on this point. This is expected behavior when infinite_inertia is on:

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.