Adding simple Ball bouncing physics, with MIDI percussion
'BOUNCING BALL
glPushMatrix
static single va=10000,yp=4.00,yv=.00, ya=.004
yv-=ya 'acceleration
yp+=yv
if yp<0
yv=-yv*.9 'bounce with energy loss
if yv<ya
yv=0 'limit rebound
else
va*=.9
ding sqr(va),35 'vol 10..127 : percussion 35..81
end if
yp=0
end if
glTranslatef 2.5,-1.5+yp,-6.0
glScalef .5,.5,.5
glCallList sphere
glPopMatrix
X