# How to animate a ball rolling down an incline?

I'm using Lagrangian mechanics to come up with the equations of motion for a ball rolling down an incline. I've come up with the following two equations.

\begin{alignat}{1} \dot{x} &= \frac{2}{3} g T \sin(θ)\\ x &= \frac{1}{3} g T^2 \sin(θ) + x_0 \end{alignat}

Where $$x$$ is the distance from its starting point to its current location, $$\dot{x}$$ is the velocity, and $$g$$ is its gravity. $$θ$$ is just the angle of the slope. To animate this, here's what I did to find my $$x$$ and $$y$$ positions:

$$y = \frac{1}{3} g T^2 \sin(θ) + y_0\\ x = \frac{1}{3} g T^2 \cos(θ) + x_0$$

Now these equations work exactly as intended for calculating the position of the ball on the slope.

The problem I’m having is combining the position equation with my velocity one since right now, the ball moves at the same speed regardless of the slope’s angle but I know the velocity equation will cause the speed to increase or decrease depending on the slopes angle. So how can I combine the position and velocity equations?

• what is the direction of the gravity field when compared to your X and Y directions. How is the angle measured? You wrote your ball is rolling. Has it any momentum of inertia? The increase of rotational energy should also be taken into the account. The translational acceleration is smaller than in frictionless sliding.
– user287001
Nov 16 '18 at 23:31
• I have a separate equation to calculate it's rotational energy that's based on ẋ. These equations were derived using Lagrangian mechanics so I start with the potential and kinetic energy and find the equations from motion from their derivatives. Right now I'm trying to figure out the sliding motion of the ball before I figure out its rotation. Again, I know how to do that based on it's position equation but now I want the speed to increase or decrease depending on how steep the slope is. Also the direction is always down the slope so it will always be going in the negative y direction.
– Brandon MacLeod
Nov 17 '18 at 0:08
• Using Galilean dynamics in case of vertical dropping the dropping speed is gT. Your equation gives for that case ẋ = 2/3 g T. Can you give some light where 33,3% was lost in 200 years?
– user287001
Nov 17 '18 at 1:09
• My kinetic energy is 1/2 M ẋ^2 + 1/4 M R^2 θ• and my moment of inertia is M R^2. My potential energy is Mg [xsin(angle) - l] where θ is the current angle of the ball, R is the radius, and M is the mass. From there I used Lagrangian mechanics to find the above equations of motion. Now what I'm trying to do is find a way to animate this. The equations I have for x and y work as the ball moves depending on the angle of the slope so now all I want to do is take my velocity equation (ẋ) and combine it with my position equation.
– Brandon MacLeod
Nov 17 '18 at 1:32
• Also θ• = ẋ/R which is why incorporating my ẋ equation into my position equation is important so I can accurately calculate the roll.
– Brandon MacLeod
Nov 17 '18 at 1:43

The acceleration of an object rolling down an incline is $$a=\frac{g\sin\theta}{1+\frac{I}{mr^2}}$$ where $$I$$ is moment of inertia about the centre of mass and $$r$$ is the radius. See slides 1-6 of these lecture notes. For a "ball" which is a solid sphere $$I=\frac25mr^2$$ therefore its acceleration down the incline should be $$a=\frac57 g\sin\theta$$
If $$x$$ is the distance the ball travels down the incline then $$\ddot x=a$$. However, if $$x$$ is the horizontal distance which the ball moves then $$\ddot x=-a\cos\theta$$ and $$\ddot y=-a\sin\theta$$. This assumes that the +x direction is to the right and the incline slopes upwards to the right.
Assuming the ball starts at time $$t=0$$ from position $$(x_0, y_0)$$ with velocity $$u$$ up the slope. Then the horizontal and vertical components of its velocity, and its co-ordinates, at time $$t$$ are $$\dot x=(u-at)\cos\theta$$ $$\dot y=(u-at)\sin\theta$$ $$x=x_0+(ut-\frac12 at^2)\cos\theta$$ $$y=y_0+(ut-\frac12 at^2)\sin\theta$$