www.pudn.com > airhockey1.rar > ball.cpp
#include "ball.h"
// Draw()
// desc: draws the ball at its current location
void CBall::Draw()
{
glPushMatrix();
glTranslatef(position.x, position.y, position.z);
glColor3f(0.5, 0.5, 0.5);
auxSolidSphere(radius);
glPopMatrix();
}
// Animate()
// desc: handles the physics calculations
void CBall::Animate(scalar_t deltaTime)
{
acceleration = CVector(0.0, -9.8, 0.0);
velocity = velocity + (acceleration * deltaTime);
position = position + (velocity * deltaTime);
}
//void CBall::Animate(scalar_t deltaTime,