vtgyrlz619
June 6th, 2004, 04:50 AM
Hi
I've researched a lot of ways to implement a moving sphere to a stationary sphere collision detection..
but I can't start because I don't know how to keep track of a moving sphere's center.
So I'm doing this game that is a clone of "Bust a Move" where there are bubbles at the top and an arrow with a shooting ball at the bottom center.. and u press a key to shoot the ball to hit the balls at the top...
Well I know the position of the shooting ball (it's on top of the arrow) and I just use glTranslatef .. to shoot the ball, however, it doesn't update the ball's center..
Here's a clip of my code.. I know that I actually do explicitly SET the ball's center to 0 0 0 but I thought that with the glTranslatef.. it actually moves the ball and updates the points (I do see the ball moving .. so the translate actually works)
printf("shoot %f \n", shoot);
Balls[ball_num].ctr[0]=0.0;
Balls[ball_num].ctr[1]=0.0;
Balls[ball_num].ctr[2]=0.0;
glTranslatef(tempx,shoot,tempz);
drawarrowball();
Please help.. how do I get the center of the moving sphere to update?
I've researched a lot of ways to implement a moving sphere to a stationary sphere collision detection..
but I can't start because I don't know how to keep track of a moving sphere's center.
So I'm doing this game that is a clone of "Bust a Move" where there are bubbles at the top and an arrow with a shooting ball at the bottom center.. and u press a key to shoot the ball to hit the balls at the top...
Well I know the position of the shooting ball (it's on top of the arrow) and I just use glTranslatef .. to shoot the ball, however, it doesn't update the ball's center..
Here's a clip of my code.. I know that I actually do explicitly SET the ball's center to 0 0 0 but I thought that with the glTranslatef.. it actually moves the ball and updates the points (I do see the ball moving .. so the translate actually works)
printf("shoot %f \n", shoot);
Balls[ball_num].ctr[0]=0.0;
Balls[ball_num].ctr[1]=0.0;
Balls[ball_num].ctr[2]=0.0;
glTranslatef(tempx,shoot,tempz);
drawarrowball();
Please help.. how do I get the center of the moving sphere to update?