Search code examples
vb.netvisual-studiophysicsmotion

Projectile Motion in VB


What I'm trying to do is simulate projectile motion in Visual Basic using Visual Studio. Essentially, something like this but without air resistance or mass.

Anyhow, the way I'm doing it is using a PictureBox and drawing the image in (of, say, a circle) every so often with a timer of interval 1 with its x and y properties being variables calculated by the formulas.

I want to know what formulas I can use to assign to x and y so that I get a movement like the one on the example. I've tried a bunch of stuff, with help from wikipedia and other sites, but can't seem to pull it off. Thanks!


Solution

  • Assume a launch speed of V, launch angle of a radians, gravity g, time t:

    x = V * cos(a) * t + g * t * t / 2
    y = V * sin(a) * t - g * t * t / 2

    Background info is here.