Skip to content

Commit

Permalink
final
Browse files Browse the repository at this point in the history
  • Loading branch information
lrsb committed Sep 8, 2020
1 parent e559d49 commit 3d83129
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ function drawScene() {
events.playing = false
updateButtons()
}

const missileDirection = utils.normalizeVector3(utils.subVector(nextPosition, position))
const missileWorldMatrix = utils.MakeWorldFromBetweenVectors(position[0], position[1], position[2], [0, 0, 1], missileDirection, 0.01)
drawModel(missile.model1 ? models.missile1 : models.missile2, missileWorldMatrix, cm)
Expand All @@ -84,7 +85,6 @@ function drawScene() {
drawModel(models.sphere, sphereWorldMatrix, cm, [0, 0, 1], true)
}


if (events.playing) missile.completion += (Date.now() - events.lastDrawTimestamp) / (1000.0 * settings.flightTime)
events.lastDrawTimestamp = Date.now()

Expand Down
2 changes: 1 addition & 1 deletion js/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function getParabolicPoint(start, end, height, completion) {
const distance = utils.modulusVector3(direction)
const g = 9.81 * height

let alpha = Math.asin((end[1] - start[1]) / distance)
const alpha = Math.asin((end[1] - start[1]) / distance)
const gamma = Math.atan2(0.5 * g * Math.cos(alpha), 0.5 * g * Math.sin(alpha) + distance) + alpha
const v0 = 0.5 * g * Math.cos(alpha) / Math.sin(gamma - alpha)

Expand Down
2 changes: 1 addition & 1 deletion js/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function loadModel(modelName) {
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR)
gl.bindTexture(gl.TEXTURE_2D, null)
events.onLoad--
if (events.onLoad === 0) $('body').removeClass('loading')
if (!events.onLoad) $('body').removeClass('loading')
}
return {vao, mesh, texture}
}
Expand Down

0 comments on commit 3d83129

Please sign in to comment.