Kinetic bodies only detect collisions in the direction they are moving, can this be changed?

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

Let’s say I have a rectangle moving from left to right across the screen, then another rectangle comes moving faster from left to right and collides with the first one. With kinematic bodies, it appears no collision is detected, only if they are both moving toward each other. Can this be changed?

is B rect too fast so jump over A rect in next frame?
can you make a simple demo project for your issue?

volzhs | 2016-05-03 04:50

I will post a small project later today, thanks!

Nichefect | 2016-05-03 11:57

:bust_in_silhouette: Reply From: Nichefect

I figured it out. The is_colliding() function only returns true if the body itself collides with something, NOT if something moves into and collides with the body.

Exactly. So if you want to know if other body collides with a kinematic body you have to check both, the kinematic and the other body. If it is the other body who collides against the kinematic you can retrieve the collider with the get_collider() or get colliding_bodies() from KinematicBody2D or RiggidBody2D and the send a message to the kinematic body to do whatever.

genete | 2016-05-05 10:10