RigidBody2D "squeeze" detection

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

Hi,

My player object (ball) is a RigidBody2D with regular circle CollisionShape2D.

How can I detect, when the player is pressed from 2 (or more) sides?
The simple collision detection (or raycasting) is not enough for me, because I want to detect that a moving (ie, falling or animated RigidBody2D) object is trying to “squeeze” the player.

Some possible cases:
1.)
enter image description here

2.)
enter image description here

3.)
enter image description here

What is the best way to achieve this?
Is there a general solution, which works for any collider types and any collision angle?

(Windows 10, Godot 2.1.5 x64)

Thank you!