Hello,
If somebody is looking for an answer for this problem years later. I was having the same issue and tracked the solution.
The main problem is the collision between Area2d, Body2D generated Physics2DServer and StaticBody2D Bodies. For this to work the StaticBody2D only reacts to entities with the monitorable flag enabled, here are the steps:
Set the collision masks and layers to make the collision happen in the same way as the godot collision nodes require.
Optional: add a body enter callback, this will be triggered when the area enters the static body. Physics2DServer::get_singleton()->area_set_monitor_callback(area_rid, area_rid, “callback_method_name”); The method callback signature is: void _on_body_monitor(int p_status, const RID& p_collider, int p_instance, int p_shape, int p_self_shape);
And the actual solution of the problem for Godot 3.x: Physics2DServer::get_singleton()->area_set_monitorable(area_rid, true);
Now this solution is slow, still better than vanilla nodes. In comparison this had 6x better performance and without the monitorable flag enabled is 40x better performance.
For the same reason the user from this post followed another approach instead of the Physics2DServer using Physics2DShapeQueryParameters inside the process.
This is a good solution if you have a project already done, but if you can change all the static bodies to areas for example, the performance will be leagues better.
In our case I fixed it using a hybrid approach. I do area and body collisions using Physics2DServer with monitorable off and I created an additional configurable collision layer for static body manual collisions as in our case all of them are in the same layers. Then in physics process query for all static bodies using query server using the same collision data. The advantage of this option is that you have more control about when the static body query is done and you can do this action each 5 frames for example instead of every physics frame. This approach has disadvantages too, scales very badly with persistent separated objects. It’s very good for short lived objects in the same screen, for example hundreds of bullets in the same screen where the monitorable scales very badly.
As note samdzebullet hell native plugin has monitorable off by default if somebody is interested in a ready available implementation.