Sign in to follow this  
fearghaill

Predicting the 2D path of a rotating rocket?

Recommended Posts

I am working on a turn-based space combat game, where the player chooses the throttle and rotation for the next 5 seconds, and then submits the turn and it proceeds. Somewhat similar to [url="http://armorgames.com/play/5426/steambirds"]Steambirds[/url], but the (semi-newtonian) physics of space flight make it somewhat more complex. What I want to be able to do is draw the projected path the ship will take, and have it update as the player adjusts the throttle and rotation controls. Simulating the movement in-engine (Unity) would not work for this, but is my backup plan if I can't make it work.

The thing holding me back is finding an equation to describe the path of an object with the magnitude of the acceleration constant, but the direction of the acceleration rotating at a constant rate.

Known variables: starting velocity/position, initial acceleration magnitude/direction, rate at whiche the direction of acceleration is changing
target variable: position after X seconds.

The extent of my physics knowledge is on working with constant, or at least average acceleration, the latter of which I think may be the answer. Does anyone know how to find the average acceleration of a rotating rocket (or other object with constant magnitude of acceleration, and rotating direction of acceleration?) My current line of reasoning is that at rotation = 360 degrees, the average acceleration will be 0, but I'm stuck on where to go from there.

Share this post


Link to post
Share on other sites
your acceleration is:

a(t) = a * [ cos[size="2"](r[sub]0[/sub]+wt) ; sin(r[sub]0[/sub]+wt) ][/size]

[size="2"]for initial angle r[sub]0[/sub], constant rate of rotation w and time t with magnitude of accleration a[/size]

[size="2"]then; your velocity is:[/size]

[size="2"]v(t) = integral(0->t) a(t) = v[sub]0[/sub] + a * [ (sin(r[sub]0[/sub]+wt)-sin(r[sub]0[/sub]))/w ; (cos(r[sub]0[/sub])-cos(r[sub]0[/sub]+wt))/w ][/size]

[size="2"]for initial velocity v[sub]0[/sub][/size]

[size="2"]and your position is:[/size]

[size="2"]x(t) = integral(0->t) v(t) = x[sub]0[/sub] + a * [ -(wt.sin(r[sub]0[/sub]) + cos(r[sub]0[/sub]+wt) - cos(r[sub]0[/sub]))/w^2 ; (wt.cos(r[sub]0[/sub]) - sin(r[sub]0[/sub]+wt) + sin(r[sub]0)[/sub])/w^2 ] + t*v[sub]0[/sub][/size]

[size="2"]for initial position x[sub]0[/sub][/size]
[size="2"][sub]
[/sub][/size]
[sub][size="2"]since the acceleration only lasts for 5 seconds; all of these become piece-wise maps; defined as above for t = 0 -> 5, and then after t = 5, you'd go back to normal equations of motion with:

a(t>5) = [0 ; 0]
v(t>5) = v(5)
x(t>5) = x(5) + (t-5)*v(5)[/size][/sub]

[size="2"]and in all cases your rotation follows:[/size]

[size="2"]r(t) = r[sub]0[/sub] + tw[/size]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this