Jump to content
  • Advertisement
Sign in to follow this  

Predicting the 2D path of a rotating rocket?

This topic is 2620 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

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 Steambirds, 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(r[sub]0[/sub]+wt) ; sin(r[sub]0[/sub]+wt) ]

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

then; your velocity is:

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 ]

for initial velocity v[sub]0[/sub]

and your position is:

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]

for initial position x[sub]0[/sub]
[sub]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)[/sub]

and in all cases your rotation follows:

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

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!