You are browsing as a guest. Sign up (or log in) to start making projects!

Ballistic Launch Calculator

  • 1 Devlogs
  • 3 Total hours

Calculates, to a reasonable degree of precision, a launch angle to hit a given target based on it’s distance and a few bits of info about the launcher

Open comments for this post

2h 32m 32s logged

Created a proof of concept This is very ugly, and just to prove that my algorithm will work in Javascript. This will also provide a “backbone” that will be torn down and rebuilt. It i just some prompt boxes and two ugly lines of formulas, but here is the code: function degrees(radians) {        return radians * (180 / Math.PI);    }    var v = Number(prompt("Enter initial velocity (m/s):"));    var d = Number(prompt("Enter distance (m):"));    var h = Number(prompt("Enter height (m):"));    var g = Number(prompt("Enter absolute acceleration due to gravity (m/s^2):"));    var thetaHR = Math.atan((d*v**2+v**2*Math.sqrt(d**2-4*((g*d**2)/(2*v**2))*((g*d**2)/(2*v**2)+h)))/(g*d**2));    var thetaLR = Math.atan((d*v**2-v**2*Math.sqrt(d**2-4*((g*d**2)/(2*v**2))*((g*d**2)/(2*v**2)+h)))/(g*d**2));    var thetaH = degrees(thetaHR);    var thetaL = degrees(thetaLR);    alert("High angle: " + thetaH + " degrees\nLow angle: " + thetaL + " degrees");

0
0
12

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…