Minecraft Physics: Steve in Drag

An object falling under constant acceleration g travels a distance h in an amount of time t given by

h = v_ot+\frac{1}{2}gt^2

where v_o is the object's starting velocity.  For an object dropped from rest, v_o=0.  Plugging that in and solving for g, we find

g=\frac{2h}{t^2}   (1)

Using this equation, we can approximate the acceleration due to gravity in Minecraft by timing how long it takes something to fall some distance.  This model assumes constant acceleration, which means it ignores things like drag forces from air resistance.  It turns out, Minecraft actually does have air resistance, but we will get there a bit later.

Youtuber nopefully used the above approximation to determine the gravitational acceleration of sand blocks (further analyzed here).  Since then, though, the addition of command blocks and scoreboards provide a simple way to time things in game, so that's the approach I'll take.

Experiment

The dropper platform

Figure 1: The dropper platform.

Timer stop and reset

Figure 2: Timer stop and reset. The clock circuit is in the background.

The experiment is simple: jump off of stuff, time it with command blocks, and plug the result in the above equation (1) to figure out the gravitational acceleration of a player.  For timing, I used Sethbling's stopwatch design.  The timer-starting command block (figure 1) is activated by a lever which also triggers a trapdoor, causing you to fall onto a pressure plate below, stopping the timer (figure 2).

I repeated this experiment five times at three different heights.  The data is in the table below (remember, a Minecraft block is 1 meter on each side):

Table 1: Results
Height (m) Average Fall Time (s) Acceleration (m/s2)
10 0.94 22.63
20 1.34 22.28
40 1.88 22.63

So using model (1), Minecraft's gravitational acceleration is around 23 m/s2.  But as I mentioned above, we're neglecting air resistance.  There isn't an easy way to experimentally measure the air resistance, but luckily a video game provides us with something that nature does not: the source code.  So let's cheat a little bit and take a look under the hood.

Cheating

In the EntityLivingBase class, there's a method named moveEntityWithHeading that is called 20 times per second (each "tick"), updating the entity's velocity.  If there isn't a block under the living entity (in other words, it's falling), the downward velocity is increased by 0.08 and decreased by 2% each tick.  This means there's a constant acceleration component that is 0.08 blocks/tick2 = 32 m/s2 and a drag force that is directly proportional to the velocity.  32 m/s2 is a lot different than our measured 23 m/s2, so clearly the drag force is not something that can be ignored.  Also, 32m/s2 is over 3 times greater than the gravity on Earth!  (An inventory of cobble is seriously heavy.)

On Earth, the gravitational acceleration is about 9.8m/s2 near the surface, and is the same for all objects regardless of how much they weigh.  This isn't the case in Minecraft, as you can see in the more detailed table on Minecraft wiki.  The "drag" contribution is also different for different entities (which is slightly more realistic since air resistance depends on the size and shape of the object).

 

Fluid Dynamics

The existence of a non-negligible drag force complicates the task of experimentally determining Minecraft's gravitational acceleration.  But it also means that we have a more fun differential equation to play with!  We can start out by writing down the equations of motion for the object falling.  From the source code, we know that the drag force is proportional to the velocity, so we can use a linear drag model for the forces:

ma=mg - kv

where m is the object's mass, a is the total acceleration, g is the acceleration due to gravity, k is some sort of drag coefficient and v is the object's velocity.  Remembering from physics class that acceleration is the first derivative of velocity with respect to time (denoted \dot{v}), we can substitute a=\dot{v}.  Doing that and diving both sides by m gives us an equation for the total acceleration:

\dot{v}=g-\frac{k}{m}v

The value of \frac{k}{m} is what's in the "Drag" column in the Minecraft wiki tableSolving for the velocity as a function of time, we find

v(t) = \frac{mg}{k}(1 - e^{-\frac{k}{m}t})   (2)

We can take some values of g and \frac{k}{m} from the table and graph the velocity (equation 2) of each of the different entities as they fall:

The velocity increases for a bit, but the rate at which it increases (the acceleration) slows with time until the entity travels at a constant velocity.  This is called terminal velocity, and it's reached when the gravitational force and the force due to air resistance balance out.  You can see that a falling player can catch up to most other entities, except for fired arrows.*

You can see the raw data in a Google spreadsheet here.  I encourage you to try out this set up and Minecraft physics experiments.  Please share your findings!

 

*So if, for example, you're engaging in a PvP fight on Overcast Network and someone tries to jump out of the world to deny you a kill, look over the edge and shoot!  Your arrow has a chance of catching up to them.

From the notes: Two masses on a string going through a hole

Two masses on a string going through a hole.  Yeah, that's the stuff we learn about in physics class.  Anyway, this is the first in a (possibly) series of posts where I work out some problem from my lecture notes or homework.  The reason for doing this is because 1) there's a (small) chance it will be useful or interesting to someone else, and 2) the drawn out process of typing this up and thinking about how to explain it helps me study.

Figure 1, two masses on a string going through a hole.

 

Consider two masses connected by a string (figure 1).  The ideal string passes through a hole in a plate which is parallel to the x-y plane.  One mass, m is sitting on the plate and is free to rotate about the hole with no friction.  The second mass, M, is hanging below the plate and moves only in the vertical z direction under the influence of gravity.   The total length of the string is l and we define r ands to be the distances between the hole and m and M, respectively, so that l=r+s.

We can use Lagrangian mechanics to explore the system.  In Cartesian coordinates, the total kinetic energy is the sum of the kinetic energy of each mass:

T=\frac{1}{2}m(\dot{x_{m}}^2+\dot{y_{m}}^2+\dot{z_{m}}^2)+\frac{1}{2}M(\dot{x_{M}}^2+\dot{y_{M}}^2+\dot{z_{M}}^2)      (1)

where we've used the dot notation for time derivatives.

Considering that m is only rotating about the z axis and M is moving only vertically, it makes sense to consider switching to a more reasonable coordinate system.  We can transform to cylindrical coordinates with:

x_{m}=r\cos\theta

y_{m}=r\sin\theta

z_{m}=0

x_{M}=y_{M}=0

z_{M}=-s=-(l-r)

Taking derivatives of these with respect to time and inserting them into (1), we can rewrite the kinetic energy in cylindrical coordinates as

T=\frac{1}{2}m(\dot{r}^2+(r\dot{\theta})^2)+\frac{1}{2}M\dot{r}^2

where r and \theta are now the generalized coordinates of the system.  The potential energy depends only on the height of M since m is confined to sit on the plate, so

V=-Mg(l-r)

With T and V we can write the Lagrangian L=T-V:

L=\frac{1}{2}m(\dot{r}^2+(r\dot{\theta})^2)+\frac{1}{2}M\dot{r}^2+Mg(l-r)

We see that \theta does not appear in the Lagrangian, which means that the generalized momentum corresponding to \theta is a conserved quantity:

p_{\theta}=\frac{\partial L}{\partial \dot{\theta}}=mr^2\dot{\theta}=rmv_m=a     (2)

a can be identified as the angular momentum of mass m.

We can also look at the total energy E=T+V:

E=\frac{1}{2}m(\dot{r}^2+(r\dot{\theta})^2)+\frac{1}{2}M\dot{r}^2-Mg(l-r)     (3)

From (2) we see that \dot{\theta}=\frac{a}{mr^2}.  Substituting this in (3) gives

E=\frac{1}{2}m\dot{r}^2+\frac{a^2}{2mr^2}+\frac{1}{2}M\dot{r}^2-Mg(l-r)

We can separate the constants on the left hand side and use the remaining terms to define an effective potential V'(r):

\frac{E+Mgl}{m+M}=\frac{1}{2}\dot{r}^2+\frac{1}{2}\frac{a^2}{m(m+M)r^2}+\frac{Mgr}{m+M}

V'(r)=\frac{1}{2}\frac{a^2}{m(m+M)r^2}+\frac{Mgr}{m+M}

Imagine m is rotating about the hole.  This means there will be some centripetal (or centrifugal, depending on your reference system) acceleration which will pull the hanging mass M up.  We want to find r such that the force is an extremum.  In other words:

\frac{\partial V'}{\partial r}=0

Setting the derivative equal to zero gives

\frac{-a^2}{m(m+M)r^3}+\frac{Mg}{m+M}=0

And solving for r:

r=\sqrt[3]{\frac{a^2}{mMg}}

which gives the radius of "orbit" of mass m about the hole for a given angular momentum a such that M remains suspended in the air.

 

The physics of Jake Brown's ollie 720

I'm a couple weeks late on this, but recently Jake Brown landed the first ever ollie 720.  To put that in layman's terms, he did two full rotations without holding the board on his feet with his hands.  Check it out:

 

 

So this seems crazy.  How did he do that?  How did he keep the board on his feet?  Magnets?  It turns out, it's actually very simple physics:

The Conservation of Energy

 

That's it!  Jake Brown doesn't really have to do anything because the conservation of energy won't be violated (it's a law!).  So yeah, thanks physics!  Skateboarding is so easy.

 

 

Popularizing Science One Operator at a Time

One thing I'm very interested in is the popularization of science and other STEM related fields.  I feel that it's very important to maintain a society that is both scientifically literate and scientifically enthusiastic.

This has motivated me to purpose a new notation for the total angular momentum operator in quantum mechanics that will be more appealing to the general public and more specifically the "cool youth" of today:

 

totalAngMom_newNotation

 

It's like flipping through a celebrity gossip magazine while you compute matrix elements!

Fun with Diffraction Gratings

A laser beam passing through a transmission diffraction grating straight on gives the standard diffraction pattern we all know and love.  It's a bit more interesting, though, if the beam hits the grating at an angle:

grating1

figure 1

Most intro optics books cover this situation, and the result is (equation 1):

a[\sin(\theta_{m}) - \sin(\theta_{i})] = m\lambda

where a is the grating spacing, \theta_{m} is the angle of the mth maxima, \theta_{i} is the incident angle, m is the maxima order, and \lambda is the wavelength. We can rewrite this (homework) in a more useful way as (equation 2):

\theta_{m}=\arcsin[\frac{m\lambda}{a} + \sin(\theta_{i})]

A similar, but slightly more complicated situation happens when you rotate the grating instead of the lazer:grating

figure 2

With a rotated grating (figure 2), the laser is still hitting the grating at an angle as it is in figure 1.  So, starting with equation 2 and using some geometry we get the angles that satisfy the maxima condition:

\theta_{m'}=\arcsin(\frac{m\lambda}{a}) + \sin(\theta_{g}) - \theta_{g}

This seemed liked a fun thing to model in Mathematica, especially since I had never played with any of the graphics features before.



You can view the source here.

You need Wolfram's CDF player, but it's totally worth because then you can look through all of the awesome demonstrations they have online.