Simple ballistics problem (SOLVED)

0 favourites
  • 3 posts
From the Asset Store
For problem solving, puzzles, bubbles, platforms and other adventures.
  • I don't get what I'm doing wrong here. It seems like a simple equation. Given time t, starting y0, ending y1, and gravity g, find the initial y velocity vy0 such that y1 is the apex (vy should be 0 at this point in time).

    Starting with basic movement equation:

    y = y0 + (vy0 * t) + (0.5 * g * t?)

    --> (vy0 * t) = y - y0 - (0.5 * gt?)

    --> vy0 = [ (y - y0 - (0.5 * gt?) ] / t

    I then set the bullet behavior angle to 270 degrees, and the speed to the absolute value of vy0, and the gravity to g. But it travels way past the point which I had intended to be the apex of the curve.

    Here is the code:

    <img src="http://dl.dropbox.com/u/12667027/Construct%202/Ballistics/ballistics.png" border="0">

    Here is the capx:

    Ballistics Capx

    What am I missing?

    -- cacotigon

  • Nevermind, I figured out what I did, the equation should be:

    vy = vy0 + gt

    vy = 0 at apex, solve for vy0

    vy0 = -gt

    Substitute vy0 into standard physics distance equation:

    y = y0 + vy0*t + 0.5gt^2

    becomes:

    y - y0 = -gt^2 + 0.5gt^2

    sqrt((y - y0) / 0.5g) = t

    vy0 = -g * sqrt((y - y0) / 0.5g)

    Ballistics works fine now.

    Here is a capx to demonstrate if anybody is interested:

    Working ballistics sample

    Maybe it can help other people.

    EDIT: P.S., Do the forums support unicode? It replaced my square root symbols (unicode symbol U+221A) with question marks.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Tom could answer the question about unicode format.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)