%% 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, physics ground width=6, physics ground depth=0.35] (G) at (0,0) {};

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

  %% The short bracket fixes the pulley to the edge of the table.
  %% The centre is one pulley radius below the line through B.east, so the
  %% horizontal string touches the upper rim and then passes over the pulley.
  \coordinate (mount) at ($(G.top-right)+(0.4,0.05)$);
  \draw (G.top-right) -- (mount);
  \node[pulley, physics pulley diameter=0.7] (P) at (mount) {};

  \node[block, physics block width=0.75, physics block height=0.75]
    (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}
