#147544 - ix78 - Sat Dec 22, 2007 2:14 pm
Hi all,
I'm writing a small game in 3D (breakout) and have already bumped into a problem >_<"
The code above should be pretty straightforward...
The problem now is I do not know the ball's actual x, y coordinate in relation to the original world coordinate for me to do collision detection with other objects in the world.
Is there a way to get access to current world matrix? Or do I have to write my own matrix functions to calculate the position?
Hope I'm not confusing anybody here :P
I'm writing a small game in 3D (breakout) and have already bumped into a problem >_<"
Code: |
float obj_x; float obj_y; float obj_origin_x; float obj_origin_y; float obj_angel; float obj_travel; void ball_fire(void) { obj_origin_x = obj_x; obj_origin_y = obj_y; obj_angel = 30; obj_travel = 0; } void ball_update(void) { glPushMatrix(); glTranslatef(obj_origin_x, obj_origin_y, 0); glRotateZ(obj_angel); glTranslatef(0, obj_travel, 0); DrawObj(); glPopMatrix(1); obj_travel += .1; } |
The code above should be pretty straightforward...
The problem now is I do not know the ball's actual x, y coordinate in relation to the original world coordinate for me to do collision detection with other objects in the world.
Is there a way to get access to current world matrix? Or do I have to write my own matrix functions to calculate the position?
Hope I'm not confusing anybody here :P