<?xml version="1.0" encoding="ISO-8859-1"?>
<rdf:RDF
	xmlns="http://purl.org/rss/1.0/"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel rdf:about="http://feeds.garagegames.com/rss/blogs/developer/62760/">
		<title>Blog for David Smith at GarageGames.com</title>
		<description>Blog feeds for Gamers and Developers in the GarageGames community.</description>
		<link>http://www.garagegames.com/</link>
		<image rdf:resource="http://www.garagegames.com/images/GarageGames_logo_small_w.gif" />
		<dc:date>2008-11-21T13:55:04+00:00</dc:date>
		<items>
			<rdf:Seq>
				<rdf:li rdf:resource="http://www.garagegames.com/blogs/62760/9957"/>
			</rdf:Seq>
		</items>
	</channel>
	<item rdf:about="http://www.garagegames.com/blogs/62760/9957">
		<dc:format>text/html</dc:format>
		<dc:date>2006-03-03T21:56:28+00:00</dc:date>
		<dc:creator>David Smith</dc:creator>
		<title>Mortar Ballistics</title>
		<link>http://www.garagegames.com/blogs/62760/9957</link>
		<description>I have been working on this problem for some time now, and I have gotten nowhere.  Consider a mortar in a FPS game, where the distance and height difference between the 2 entities are known variables.  What I have so far is:&lt;br&gt;&lt;br&gt;angles[YAW] --- left right [0...360] degrees&lt;br&gt;angles[PITCH] --- up down [0...90] degrees&lt;br&gt;angle = angles[YAW] * (M_PI * 2 / 360)&lt;br&gt;sy = sin(angle)&lt;br&gt;cy = cos(angle)&lt;br&gt;angle = angles[PITCH] * (M_PI * 2 / 360)&lt;br&gt;sp = sin(angle)&lt;br&gt;cp = cos(angle)&lt;br&gt;forward[0] = cp * cy&lt;br&gt;forward[1] = cp * sy&lt;br&gt;forward[2] = -sp&lt;br&gt;forward[0] = forward[0] * 3300&lt;br&gt;forward[1] = forward[1] * 3300&lt;br&gt;forward[2] = forward[2] * 1650&lt;br&gt;&lt;br&gt;Length of this vector is the speed of the projectile.  In the calculation the speed of the projectile is different at different angles.  You will notice that the speed is not depended on YAW angle but only on PITCH angle.  The speed goes from 1650 at PITCH of 90 degrees and to 3300 at PITCH of 0 degrees.  All the middle values are determined by the upper formulas.  Hopefully all this can be simplified so YAW angle won't be in the equation.  The launch speed is determined by the angle, so basically it is another variable and not a constant in the calculations.  So, would the following equation be correct :  launch_speed = sqrt [3300^2 * cos^2(PITCHangle) + 1650^2 * sin^2(PITCHangle)].  Hope it is right I just did it by heart.  And of course this can be reduced down to use only cos or sin.  The following equations were my initial ones I was using :&lt;br&gt;&lt;br&gt;v_o is the velocity of the projectile&lt;br&gt;v_x(t) is the x speed at time t&lt;br&gt;v_y(t) is the y speed at time t&lt;br&gt;theta is the launch angle&lt;br&gt;h is the maximum height of the projectile&lt;br&gt;b is the landing height of the projectile&lt;br&gt;R is the total distance traveled in x&lt;br&gt;&lt;br&gt;Formulas for targets higher than the launch point&lt;br&gt;x(t) = v_o * cos(theta) * t&lt;br&gt;y(t) = v_o * sin(theta) * t&lt;br&gt;v_x(t) = v_o * cos(theta)&lt;br&gt;v_y(t) = v_o * sin(theta) - g * t&lt;br&gt;v(t) = sqrt(v_o^2 - 2 * g * t * v_o * sin(theta) + (g * t)^2)&lt;br&gt;h = (v_o^2 * sin(theta)^2) / 2 * g&lt;br&gt;R = v_o * T * cos(theta)&lt;br&gt;T = (v_o * sin(theta) / g + sqrt(2 * (h - b) / g)&lt;br&gt;&lt;br&gt;Formulas for targets lower than the launch point&lt;br&gt;x(t) = v_o * cos(theta) * t&lt;br&gt;y(t) = v_o * sin(theta) * t&lt;br&gt;v_x(t) = v_o * cos(theta)&lt;br&gt;v_y(t) = v_o * sin(theta) - g * t&lt;br&gt;v(t) = sqrt(v_o^2 * 2 * g * t * v_o * sin(theta) + (g * t)^2)&lt;br&gt;h = b + (v_o^2 * sin(theta)^2) / (2 * g)&lt;br&gt;R = v_o * T * cos(theta)&lt;br&gt;T = (v_o * sin(theta) / g + sqrt( 2 * h / g)&lt;br&gt;&lt;br&gt;For horizontal motion -&amp;gt;&lt;br&gt;  Horizontal velocity = &lt;br&gt;a_x = 0&lt;br&gt;v_x = v_ox&lt;br&gt;  Horizontal distance = &lt;br&gt;x = v_ox * t&lt;br&gt;&lt;br&gt;For vertical motion -&amp;gt; &lt;br&gt;  Vertical velocity =&lt;br&gt;a_y = -g = 9.8 m/s^2&lt;br&gt;v_y = v_oy - g * t^2&lt;br&gt;  Vertical position =&lt;br&gt;y = v_oy * t - 0.5 * t^2</description>
	</item>
</rdf:RDF>
