.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

Raging Tiger- Save $9.00
winSPMBT: Main Battle Tank- Save $5.00

   







Go Back   .com.unity Forums > Shrapnel Community > Space Empires: IV & V

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #15  
Old August 17th, 2007, 10:14 PM
Suicide Junkie's Avatar
Suicide Junkie Suicide Junkie is offline
Shrapnel Fanatic
 
Join Date: Feb 2001
Location: Waterloo, Ontario, Canada
Posts: 11,451
Thanks: 1
Thanked 4 Times in 4 Posts
Suicide Junkie 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.

So, lets see. (x,y are coords, * is multiplication)
For X:
S1x-S2x = (V1x-V2x) * T + ((A1*cos(Theta)) -A2x) * T * T
For Y:
S1y-S2y = (V1y-V2y) * T + ((A1*sin(Theta)) - A2y) * T * T

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).

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.

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)
Reply With Quote
 

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 12:06 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.