View Single Post
  #39  
Old August 17th, 2007, 10:30 PM
narf poit chez BOOM's Avatar

narf poit chez BOOM narf poit chez BOOM is offline
Shrapnel Fanatic
 
Join Date: Mar 2003
Location: CHEESE!
Posts: 10,009
Thanks: 0
Thanked 7 Times in 1 Post
narf poit chez BOOM is on a distinguished road
Default Re: OT: Looking for a good physics site

The acceleration for X will be cos(theta) times the ship's engine power, while the acceleration for Y will be sin(theta) times the engine power.

And theta will be the direction to accelerate in.


Got that far. It's the whole 'How do I calculate theta' that's the problem.

S1x-S2x = (V1x-V2x) * T + ((A1*cos(Theta)) -A2x) * T * T

V1x would be Enemy Velocity X, A1 would be Acceleration Vector Length, Theta would be the angle to accelerate in, A2x would be Target Acceleration X and T would be Time?
What are S1 and S2?

Unknowns are Theta and T, common to both.
You can rearrange the first formula to get Theta = F(T)... there will be inverse cos or inverse sin in it.
Replace the Theta in the second equation with F(T).


What is 'F'?

Now you've got a big horrid, fearsome beasty with only T as an unknown. Solve for T. You'll probably need a big sheet of paper, or maybe maple to simplify it down to a one-line equation to code in.
Now I'm wondering which variation of that formula you gave I should use to figure out T or Theta or whatever it's supposed to give me.
Plus, I think that 'Big sheet of paper' part may put it somewhat outside my mathematical ability.

Plug T into the first formula again, and Solve for Theta.

Your ship/missile can then accelerate in the direction of Theta for time T. (Theta = 0 means the +X direction, 90 degrees = +Y)

Yeah, I may need a bit of help to figure out exactly how to do that.

Going to have to fiddle with the angle, then. C# uses radians for 3d object angles and 0 is +Y (Although I'm using X and Z for horizontal and vertical).

@Jack: That formula you gave me gives Time, right?

I'll go let my brain collapse for a while, then come back and see if I can figure this out. If brute force can figure it out, then I may be able to turtle my way through before my brain starts screaming at me.
__________________
If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++
Some of my webcomics. I've got 400+ webcomics at Last count, some dead.
Sig updated to remove non-working links.
Reply With Quote