problem about bouncing sphere

Started by
0 comments, last by JY 18 years, 8 months ago
I can make the ball falling....but till it hit the floor.....it wont jump....dont know y!! can help me check and modify...thanks a lot!! void MyObject::TickAnimation() { pos.fY -= GRAVITY; pos += vel; if (pos.fY > CEILING_HEIGHT) { vel.fY = -abs(vel.fY); pos.fY = 2 * CEILING_HEIGHT - pos.fY; } else if (pos.fY < GROUND) { vel.fY = abs(vel.fY); pos.fY = 2 * GROUND - pos.fY; } } void MyObject::DrawSelf() { glPushMatrix(); glTranslatef(100, pos.fY, 200); glutSolidSphere(15,30,30); glPopMatrix(); }
-=[LOVE always, LIVE forever]=-
Advertisement
What does happen? And what are GROUND and CEILING defined as?
"Absorb what is useful, reject what is useless, and add what is specifically your own." - Lee Jun Fan

This topic is closed to new replies.

Advertisement