About

The following is a description of a cannon, created by Wizardry and Steamworks and offered freely on marketplace, that is designed to calculate and display various firing parameters. It is a simplistic variation on artillery since the cannon does not fire automatically but instead allows the user to control the firing parameters. Possible applications can include role-play simulators or the like and possibly an implementation of the various tank-like games (Worms, etc…).

Video

Exports

Assets

Asset Description
Cannon Firing Sound

Using

  1. Unpack the jute and extract the cannon, sample wall and quick help document.
  2. Rez the cannon.
  3. Place the wall somewhere no further than $91m$ away from the cannon.
  4. Use the arrows on the cannon gear box to rotate the cannon and elevate the barrel.
  5. Long-press (left-click and hold) the barrel to accumulate velocity.
  6. Release the left mouse button and the cannon will fire.

Sample Wall and Possible Applications

The sample wall contains the health script and can be molded into a different object. Or, the script can be taken out and placed in an entirely different build. When the health meter reaches zero, the script pauses for one second and then derezzes the build.

It is possible to build a small enclosure around the cannon and play a tank-like game where each player must destroy the other players' fortresses.

The Build

The cannon assembly.

Physics

The following section describe the various calculations performed by the cannon. These calculations not only determine the firing velocity but computes various data for the overhead text. The cannon computes the horizontal distance (grid-distance) to the impact coordinates and also displays the nozzle elevation.

Calculating Time to Maximal Altitude

The initial velocity increments linearly by touch-and-holding the cannon barrel. When the avatar stops touching the barrel, the cannonball is fired with the accumulated velocity.

The velocity vectors for $x$ and $y$ where $x$ represents the horizontal axis and $y$ represents the elevation are given by:

\begin{eqnarray*}
V_{x0} &=& v*\cos(\Theta) \\
V_{y0} &=& v*\sin(\Theta)
\end{eqnarray*}

When the vertical component is zero at peak altitude, we have that:

$V_{y}(t)=V_{y0}-gt=0$

thus, extracting $t$, the time to reach the peak altitude, we obtain:

$t_{peak}=\frac{V_{y_0}}{g}$

Substituting Values

By design we have that the capped maximum velocity ($V_{max}$) of the cannon is $30\frac{m}{s}$. We also know that the maximal distance can be obtained by making $\Theta=45^\circ \approx .785398 \text{ radians}$. This is because of the $\sin$ and $\cos$ functions overlap at $\Theta=45^\circ \approx .785398 \text{ radians}$:

Would we have chosen any angle so that $\Theta \neq 45^\circ$, then the $V_{x0}$ and $V_{y0}$ would have started to decrease, one in function of the other.

Thus, substituting for $V_{x0}$ and $V_{y0}$, we have:

\begin{eqnarray*}
V_{x0} &=& 30*\cos(45^\circ) \approx 21.2132\frac{m}{s} \\
V_{y0} &=& 30*\sin(45^\circ) \approx 21.2132\frac{m}{s}
\end{eqnarray*}

And $t$ at peak altitude, since the gravitational acceleration is $g=9.81$:

$t_{peak}=\frac{V_{y_0}}{g}=\frac{22.98133}{9.81}\approx 2.16241s$

Finding Horizontal Distance Travelled

Deriving $V_{x0}$ in time, we have that:

$d(t)=V_{x0}*t$

Since it takes the same amount of time to reach maximum altitude as it takes to fall back down, we have that:

$d(t)=V_{x0}*2t_{peak}$

Substituting Values

We obtain that for a maximum elevation of $45^\circ$ and a maximum firing velocity of $30\frac{m}{s}$, the horizontal travel distance is:

$d(t) \approx 21.2132 * 4.32482 \approx 91.74327m$

which gives us the maximum firing range for the cannon.

Limitations

  • The maximum firing distance is given from the above calculations as $\approx 91.74327m$.
  • The maximum firing velocity is $30\frac{m}{s}\pm.3$.
  • The minimum firing velocity is capped at $10\frac{m}{s}$. This is to ensure that the projectile travels through the barrel (since the projectile rezzes at the centre of the barrel and is not bounded by the barrel's dimensions).
  • The maximum elevation of the barrel is $50^\circ\pm.001$ starting from $0^\circ\pm.001$.

Index


secondlife/artillery/cannon.txt · Last modified: 2022/11/24 07:46 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.