SandCastleIcon.png This page has links to websites or programs not trusted by Scratch or hosted by Wikipedia. Remember to stay safe while using the Internet, as we can't guarantee the safety of other websites.
Document stub.png This article is a stub. It may be incomplete, unfinished, or have missing parts/sections. If the article can be expanded, please do so! There may be suggestions on its talk page. (August 2018)
Document stub.png This article or section may not have content matching Scratch Wiki editing standards. Please improve it according to Scratch Wiki:Guidelines and Scratch Wiki:Editing Conventions. (February 2017)
Reason: Doesn't talk about any connection to Scratch, written very informally
DocumentInQuestion.png It has been suggested that this page's contents be merged with the page Shooting Projectiles. You can discuss this on the page's talk page. (November 2017)

In Scratch, a useful equation is the Trajectory formula. This formula is useful for projects including:

  • Rocket or baseball simulators
  • Tank games
  • Anything that includes the curve of a projectile

The formula(e) calculate(s) where on the screen the projectile should be. As well as calculating this, there are many other formulae that calculate different things

These are the formulae:

Horizontal velocity: v°x = v°cos(ß)
Horizontal distance: x = a+v°xt
Vertical velocity: v°y = v°sin(ß)-gt
Vertical distance: y = b+v°sin(ß)-0.5gt²

    v° is the initial velocity,
    ß is the projectile angle (from -90 to 90),
    a & b are the starting coordinates,
    g is the informal gravity constant 9.81
    and t is the time since the launch

Other formulae include:

Maximum height: H = b+[v°²sin²(ß)]/[2g]
Horizontal range: R = [v°²sin2(ß)]/[g]-a

sin(ß) and cos(ß) are the vertical and horizontal components (or velocities)

See Also