Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Realistic Basketball Arc

I am writing Open GL using the glut, gl, and glu libraries in Visual C++. I am quite new at this. I am currently doing my first animation. I was wondering if anyone knew a way to program a relatively realistic arc for a basketball. It doesn't have to be too realistic, as I only know the basics, but I thought there might be a way to implement the math library and use a derivation of the following formula (which is the only way I know to create a circle, in 2D):
for (i = 0; i < n; i ++)
{
x = Rad * cos((360 * i)/n) + 100;
y = Rad * sin((360 * i)/n) + 100;

any help would be appreciated...

Comments

  • erezsherezsh Member Posts: 1
    Hi.

    Simply follow physics:
    Px = Px + (Vx / Slowdown)
    Py = Py - (Vy / Slowdown)
    Vy = Vy - g;

    (Px,Py) = Position of ball
    (Vx,Vy) = Velocity
    g = gravity (= 9.8, or anything else u want)
    Slowdown = amount of slowing down the ball...
    ------

    Just use this every frame and the ball will move realisticly...
  • Karl007Karl007 Member Posts: 27
    : Hi.
    :
    : Simply follow physics:
    : Px = Px + (Vx / Slowdown)
    : Py = Py - (Vy / Slowdown)
    : Vy = Vy - g;
    :
    : (Px,Py) = Position of ball
    : (Vx,Vy) = Velocity
    : g = gravity (= 9.8, or anything else u want)
    : Slowdown = amount of slowing down the ball...
    : ------
    :
    : Just use this every frame and the ball will move realisticly...
    :

    Add linear damping (air resistance) and it will be almost perfect :)
    Vx -= damping*Vx
    Vy -= damping*Vy


Sign In or Register to comment.