Elastic collisions between blocks
APL (Dyalog Classic), 18 16 bytes



¯1+⌈○÷¯3○.5*⍨⎕÷⎕


Try it online!

rendered as the equivalent {¯1+⌈○÷¯3○.5*⍨⍵÷⍺} in the tio link, to facilitate testing; ⎕ means evaluated input; ⍺ and ⍵ are the arguments to an anonymous function

$$\left\lceil\frac\pi{\textrm{arctg}\sqrt\frac ba}\right\rceil-1$$

(that's the formula from the video. i recommend watching it. it's well explained and the animations are great for building intuition.)