Lagrangian of two balls in space

I know the Lagrangian of a free ball with mass $m$ is $$\mathcal{L}=\frac{1}{2}m\dot{\vec{x}}^2.$$

How can I produce a Lagrangian with two interacting balls with masses $m_1,m_2$ and radii $r_1,r_2$? The kinetic energy should be just $$T=\frac{1}{2}m_1\dot{\vec{x_1}}^2+\frac{1}{2}m_2 \dot{\vec{x_2}}^2,$$

I haven't included rotational energy because I think that would come up only if there was friction between the balls, which I do not want.

Here $\vec{x_i}$ is the center of ball $i$. But what will the potential energy be? I know the constraint that they do not go in side each other is $$||\vec{x_1}-\vec{x_2}||\leq r_1+r_2.$$ But this does not give me any interaction. In the sense that they change directions once they impact. What am I missing?

Maybe the potential is infinite for $||\vec x_1-\vec x_2||\leq r_1+r_2$.

$$V_{hardsphere} = \Big\{ \begin{smallmatrix} \infty &||\vec x_1-\vec x_2||\leq r_1+r_2 \\ 0 &||\vec x_1-\vec x_2||\gt r_1+r_2 \end{smallmatrix}$$

The impact would be a result of your initial conditions, they might be launched at one another for example. I can't think of a way to represent that mathematically other then checking for the condition above after writing your particular solutions down.

Analysis of scattering problems requires some sort of description of the central force between the two objects. If you wish your two objects to be hard impenetrable spheres, then your potential will be infinite. I recommend Pauli's answer but with a small modification. Let the potential be:

$$V(\vec x_1, \vec x_2) = \begin{cases} 0 & |\vec x_1 - \vec x_2| > r_1 + r_2 \\ a & | \vec x_1 - \vec x_2 | \leq r_1 + r_2 \end{cases}$$

Then take the limit as $a \rightarrow \infty$ after finding the equations of motion. Be careful with your derivatives, and be prepared for some sort of Heaviside functions.

What forces do you want to consider? There isn't really a generic notion of "interacting balls"

If the balls are attached by a spring, your Lagrangian is:

$$L = \frac{1}{2}m_{1}{\dot {\vec x}}_{1}^{2} + \frac{1}{2}m_{2}{\dot {\vec x}}_{2}^{2} \frac{1}{2} -k\left({\vec x}_{1} - {\vec x}_{2}\right)^{2}$$

If the are interacting through gravity, it is:

$$L = \frac{1}{2}m_{1}{\dot {\vec x}}_{1}^{2} + \frac{1}{2}m_{2}{\dot {\vec x}}_{2}^{2} + \frac{Gm_{1}m_{2}}{\left|{\vec x}_{1} - {\vec x}_{2}\right|}$$

There are many other choices. It ultimately depends on what effect you are studying.