Blender Physics

File > New > General

Hit x and delete

Shit + A > Mesh > Torus

Right click > Shade Smooth

Physics Properties > Collisions > Shape > Mesh

Copy

Paste

Move

Rotate X 90

Copy two torus

Paste

move

longer

Play

Select one torus
Enable physics for Ridged body

Rigid body type > Passive

play

code