Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

TerranFury

Ballistic Missiles

This topic is 5730 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Every once in a while, I think of a physics problem that I just can''t seem to solve. Now I''m trying to figure out the trajectory of ballistic missiles. Happily, ballistic missiles are quite common in games, so this is nicely on-topic for this forum. I''ll explain what I''ve reasoned so far. First, the thrust stage of the flight. The first issue is thrust itself. For simplicity''s sake I''ll call the magnitude of the thrust some constant k - because it is nearly constant for most of its duration. Now, I would assume thrust is tangent to the missile''s path (tell me if I''m wrong). If so, then the thrust vector, Ft = (k/|v|) * v That equation is basically just the velocity, normalized, and scaled to a magnitude of k. The one other force (we''ll ignore aerodynamics) is gravity. Fg = [0, mg] As a result... ma = Ft + Fg (I''ll assume unrealistically that the mass of propellant lost is negligible to keep things easy, so m is constant) And then velocity (v) is the first integral of that with respect to time, and displacement (s) is the second. Finally, we know some initial conditions: Ft(0) = [cos(theta), sin(theta)] v(0) = 0 ...and for simplicity''s sake... s(0) = 0 I''d integrate over the interval [0, t] where t is the duration of thrust to get the first displacement and velocity, s1 and v1. The second stage of the flight is simple Physics 101 ballistic motion, and I can figure that out easily enough. My problem is solving the first part. I think I''ve worked out the starting information decently enough, but I just cant solve these equations. Velocity is the integral of thrust - but wait; the direction of thrust is dependant on velocity! Ah! I could solve this in a game using a numerical technique, but I''m very very curious to see if there is an analytic solution (there must be!). Could I get some help with this thought problem?

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Don''t forget "drag"!

The speed of your missile would only accelerate more and more.
If your missile is in the athmosphere, a lot of the rocket power goes to displace the air. I have no clue what supersonic speeds means for all this but at low speeds usually models the drag force as something similar to

Fd = - Cv * S * v

where
Cv is a coefficient of ... (forgot the name) (during the 80''th cars were sold with a Cv number specified around 0.6 (?))
S is the projected area in the forward direction (for a cylindric rocket: 2*pi*R^2 )
v the velocity

However the formula above is a _model_ of the behavour in a vicous fluid (=air). Another model is to use v^2 instead of v.
And probably something interesting happens around the speed of sound...

/Ola




Share this post


Link to post
Share on other sites
I think your problem has to do with your definition of thrust. You say at the bottom of the post that v(0)=0, but Ft(0)=. And the equation at the top, Ft = (k/|v|) * v, contradicts the initial conditions.

So basically what I think is happening is that you are saying:

Ft(0)==(k/|v|)*<0,0>

Thrust, according to this equation, depends on the angle of the missle, theta. This vector will not always be zero as you say it is for the initial condition. So the contradiction is in your first equation because Ft(0) != (k/|v|)*<0,0>.


I hope this helps. If you do find the solution to this problem, please post it here because I am always interested in things like this.

--------------------
Nicholas Skapura
skapura.2@wright.edu
http://skap.8k.com
AIM: skap35

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I think your problem has to do with your definition of thrust. You say at the bottom of the post that v(0)=0, but Ft(0)= <cos(theta),sin(theta)> . And the equation at the top, Ft = (k/|v|) * v, contradicts the initial conditions.

So basically what I think is happening is that you are saying:

Ft(0) = <cos(theta),sin(theta)>=(k / |v|) * <0,0>

Thrust, according to this equation, depends on the angle of the missle, theta. This vector will not always be zero as you say it is for the initial condition. So the contradiction is in your first equation because Ft(0) != (k / |v|) * <0,0> .


I hope this helps. If you do find the solution to this problem, please post it here because I am always interested in things like this.

Sorry about double posting, my first one was all messed up for some reason.

Share this post


Link to post
Share on other sites

  
void CMissile::Missile(const Vector& Position, const Vector& Direction)
{
k = 10000.0f;
d = 100.f;
dir = Direction;
pos = Position;
v = Vector(0, 0, 0);
Gravity = (0, -9.81, 0);
mass = 5.0f;
t = 0.0f;

Update(0.0f); // update one time to fire the missile.

}

void cMissile::Update(float dt)
{
t += dt;

// rocket not out of fuel

if (t < 10.0f)
Thrust = dir * k;

Drag = -d * v;
acc = (Thrust + drag) / Mass + Gravity;
pos += v * dt + acc * dt*dt;
v += acc * dt;
dir = v.UnitVector();
}


all lies on the dir = v.UnitVector()

you can set the direction to anything you want really, to make a heat seeking missile, or a standard rocket with no trajectory correction.

to do a seeking missile, it''s easy.


  
void Seek(const Vector& Target)
{
Vector SeekDirection = (Target - pos).UnitVector();
Vector AxisOfRotation = dir x SeekDirection;

// missile not pointing towards the target, so change direction. if target behind missile, it won''t seek the target

if (AxisOfRotation.GetLength() > 0.0001f)
{
float angle = acos(SeekDirection * dir);

if (angle > MaxRotationSpeed)
angle = MaxRotationSpeed;

if (angle < -MaxRotationSpeed)
angle = -MaxRotationSpeed;

dir.RotateAroundAxis(AxisOfRotation, angle);
}
}

Share this post


Link to post
Share on other sites
Anon:

I thought about including drag (probably the |v|2 version since missiles move pretty quickly), but figured it would make things too complicated. If anyone can figure out the answer to my question also knows to include drag, though, I'd welcome the addition.

skap20:

I was thinking along the same lines. I wonder if there's a better way to define thrust.

Still, even with the current definition, as v approaches 0, k /|v | approaches infinity. Now, the equation is F t = (k /|v |)v , or basically (quantity approaching zero) * (quantity approaching infinity) , which can equal some real value in between! So I'm not sure it really needs to be redefined, but I admit it might be easier with an alternative.

oliii:

Thanks for the code! It looks like you're basically using explicit Euler integration. I was wondering if a complete analytic solution existed which would not require any numerical integration. I know it's kind of useless; If I were really coding a game I'd use your method.

All:

I'm just curious, basically, and thought maybe some of you would be interested in this problem too.

[edited by - TerranFury on April 1, 2003 10:32:49 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I don''t think there is a general analytic solution to this problem.

Share this post


Link to post
Share on other sites
It''s a system of differential equations. By Newton''s law, F = ma:

F = m * dv / dt

where v is the velocity vector. You want F to be of magnitude T (thrust) and in the direction of v:

F = T * v / |v|

You have two components (vx,vy)

T * vx / sqrt(vx² + vy²) = m * dvx / dt
T * vy / sqrt(vx² + vy²) = m * dvy / dt

These differential equations are coupled; other than a few select cases, I am not able to solve these yet (next year, I will). At least you can see how this problem should be expressed mathematically.

Cédric

Share this post


Link to post
Share on other sites
Thanks a lot cedricl!

I had gotten that far on paper too, by combining all the equations I listed in my first post. I'm glad my work agrees with yours there. The only difference is I included gravity.

m (dv x/dt) = (kv x)/sqrt(v x2 + v y2)

m (dv x/dt) = (kv x)/sqrt(v x2 + v y2) + mg
(using g < 0)

I guess that once v (t) is found, finding s (t) should be straightforward integration.

Can anyone help me solve that system of differential equations? Or, as the last Anon suggested, is there really no general analytic solution?

[edited by - TerranFury on April 1, 2003 5:49:50 PM]

Share this post


Link to post
Share on other sites
The equations look a lot less mean if we make the change to "polar" coordinates:

cos(theta) = vx / sqrt(v)
v = sqrt(vx² + vy²)

After replacing vx, vy, the square roots and their derivatives in the differential equations, I get

x:
T / m = dv / dt - v * tan(theta) * dtheta / dt

y:
T / m - g = dv / dt + (v / tan(theta)) * dtheta / dt

It''s still not trivial, but I feel closer to the solution.

I''ll think about it tonight.

Cédric

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!