Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6205385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:15:53+00:00 2026-05-24T05:15:53+00:00

I don’t really know math well beyond Algebra 1, however I can usually hack

  • 0

I don’t really know math well beyond Algebra 1, however I can usually “hack” a math book and make the equations work in software I write – I’m trying to write a program that has objects moving onscreen, with momentum, velocity, mass, thrust, etc which seems to be called Vector Math.

How would I go about converting between the world of cartesian coordinates x & y to the world of physics? For instance, how do I determine the increment amount per iteration of a loop in order to create a flying object that simulates a (2d) spacecraft in terms of behavior with simple left-right-up-down thrusters?

An example of what I”m trying to figure out:

x=x+getnextstep(thrust, direction).x
y=y+getnextstep(thrust, direction).y

so I would input an amount, say 0-127 for thrust and 0-360 as direction, and get back the amount to increment

Please answer in psuedocode if possible and if you feel patient enough, explain the how the conversion is done between the cartesian step-wise and momentum/mass/velocity world.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T05:15:54+00:00Added an answer on May 24, 2026 at 5:15 am

    Start with 1D.

    Velocity is the rate of change of position over time. At time t1, an object is at position x1. You let it coast at constant velocity v, from time t1 to time t2. The distance it’s traveled (x2-x1) is velocity (v) multiplied by elapsed time (t2-t1):

    (x2-x1) = v (t2-t1)
    x2 = x1 + v (t2-t1)

    Or in code:

    x += v dt

    where dt is the amount of (simulated) time since you last updated everything.

    Acceleration is the rate of change of velocity over time. If acceleration is constant, you have to keep track of x and v, and we get

    x += v dt + a(dt)/22
    v += a dt

    (Note that you can’t reverse the order of those steps, not without changing the algebra.)

    That’s enough to simulate an object sliding back and forth with a single thruster. You control the “a” which is supplied by the thruster. If you want vertical motion in a gravity field, gravity applies its own acceleration; just add gravity to the acceleration of the thruster, and that’s your a. (The acceleration of gravity points down, by definition, and by convention it’s called “g”.)

    Don’t worry about momentum or energy for now. Or friction or air resistance. Or collisions.

    2D: motion in x and motion in y are basically independent, so you can just treat them as two 1D motion simulations: {x, vx, ax} and {y, vy, ay}.

    If you want a thruster you can point (e.g. 0-360), you must break up that vector into an x component and a y component, then apply the above. Breaking up a vector like that is trigonometry; if you’re not familiar with it, you’ll have to crack a book (or wikipedia). It’s not that complicated, but it’s hard to explain here.

    That should keep you busy for a while. If it’s too easy and you want a greater challenge, look at the first few chapters in an introductory physics text.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Don't really know how to formulate the title, but it should be pretty obvious
Don't know why I can't reply to people on here with only a small
Don't know why but I can't find a solution to this. I have 3
Don't let below code scare you away . The question is really simple, only
Don't know how to google for such, but is there a way to query
I don't know when to add to a dataset a tableadapter or a query
Don't know if I worded the question right, but basically what I want to
(Don't know if this is strictly on-topic, but I don't see any better Stack
Don't know if this has been asked before, so point me to another question
Don't know how to explain it better but i'm trying to get a response

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.