Programmatically added rigid bodies do not collide

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

I am drawing polygon2d rectangles with the mouse, where I am dynamically generating the points based on the drag start/end and direction vector. These are then assigned via PoolArrayVector2D to the collision and polygonal shapes.

I can successfully display the polygon2d’s generated and debug visualize collision shows there is a collision shape that matches the visual shape.

However, I am not getting any collision when I drop duplicate rigidbody balls onto them.

I have included the pastebin for the relevant code. I can also up the project if required.

:bust_in_silhouette: Reply From: xdfo

I figured it out. I completely forgot that collision shapes do nothing on their own other than report collisions so I simply replaced the Area2D scene root for the rectangle scene with a staticbody 2d and now I can draw colliding rectangles.