Rotation Problem...

SephirothSephiroth Fayetteville, NC, USA
OK, I have FINALLY figured out rotation, for the most part! Now, I use a float variable for my player's heading, which can be 0.5 to 360, with increments of 0.5 degrees. With that said, when I rotate, even as little as 0.5 degrees, all polygons do complete rotations about 1000 times. What's up with that? Below is my source.
x_m = sector1.triangle[loop_m].vertex[loop].x;
y_m = sector1.triangle[loop_m].vertex[loop].y;
z_m = sector1.triangle[loop_m].vertex[loop].z;
u_m = sector1.triangle[loop_m].vertex[loop].u;
v_m = sector1.triangle[loop_m].vertex[loop].v;

o_x = x_m - player.xpos;
o_y = y_m - player.ypos;
o_z = z_m - player.zpos;

y_m = ((o_y * cos(player.lookup)) - (o_z * sin(player.lookup)));
z_m = ((o_z * cos(player.lookup)) + (o_y * sin(player.lookup)));
o_y = y_m;
o_z = z_m;
z_m = ((o_z * cos(player.heading)) - (o_x * sin(player.heading)));
x_m = ((o_x * cos(player.heading)) + (o_z * sin(player.heading)));
o_x = x_m;
x_m = ((o_x * cos(player.lookup)) - (o_y * sin(player.lookup)));
y_m = ((o_y * cos(player.lookup)) + (o_x * sin(player.lookup)));
Now right after this code I send the new x_m, y_m, and z_m of each vertex through to OpenGL to have z-buffered and drawn on-screen. I know, it isn't clipped, but right now I want to get the thing working before I start clipping routines. Can you tell me what I am doing wrong here?


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!