for the fps im making i am doing bullet physics… here is my code so far
class paint
{
public:
GLfloat heading;
GLfloat xpos;
GLfloat zpos;
GLfloat ypos;
int go;
void newPaint(GLfloat heading1, GLfloat xpos1, GLfloat ypos1, GLfloat zpos1);
void updatePaint();
void drawPaint();
};void paint::newPaint(GLfloat heading1, GLfloat xpos1, GLfloat ypos1, GLfloat zpos1)
{
xpos = xpos1;
ypos = ypos1;
zpos = zpos1;
heading = heading1;
go = 1;
}void paint::updatePaint()
{
xpos += (float)sin(headingpiover180) * 0.5f * speed;
zpos += (float)cos(headingpiover180) * 0.5f * speed;
}void paint::drawPaint()
{glTranslatef(xpos, 5.5f, zpos);
ballmesh.Render(1.0f, 0.0f, 0.0f);
}
paint ball[100];
for(int i = 0; i < 100; i++)
{
if(ball[i].go == 1) ball[i].updatePaint();
}
for(int j = 0; j < 100; j++)
{
if(j > 1) glTranslatef(ball[j - 1].xpos, -5.5f, ball[j - 1].zpos);
if(ball[j].go == 1) ball[j].drawPaint();}
id(mouseclick)
{
ball[ballcount].newPaint(mcamera.heading , mcamera.xpos, 5.5f, mcamera.zpos);
ballcount++;}
it works fine for the first ball, but all the balls after that get a weird heading!
please hlep
[This message has been edited by c_olin (edited 05-14-2003).]