%% mechanics-pulley-flat-plane.tex
%% A block on a horizontal surface connected to a hanging block.

\documentclass[tikz,border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{tikzphysics}

\begin{document}
\begin{tikzpicture}
  \node[ground, ground width=6, ground depth=0.35] (G) at (0,0) {};

  \node[block, block width=0.9, block height=1,
        anchor=south] (B) at (G.top-30) {$m_1$};

  %% The short bracket fixes the pulley to the edge of the table.
  %% The default pulley diameter and the block height are both 1cm. Placing
  %% the centre on the surface level therefore makes the string from B.east
  %% horizontal and exactly tangent to the upper rim.
  \coordinate (mount) at ($(G.top-right)+(0.5,0)$);
  \draw (G.top-right) -- (mount);
  \node[pulley] (P) at (mount) {};

  \node[block, minimum width=8mm, minimum height=1cm]
    (H) at ($(P.east)+(0,-2.1)$) {$m_2$};

  %% Both straight portions end at computed tangent points on P.
  \physicsstringoverpulley{B.east}{P}{H.north}
\end{tikzpicture}
\end{document}
