31337

12-31-2002, 03:59 PM

Ok so I'm trying to do freelook. For those of you unfamiliar with the concept, its found in games like Halflife, Quake, and virtually every other first person shooter. The way it works is the mouse changes the viewing and then the keyboard buttons will move towards the viewing point, perpendicular to the viewing point, or away from the viewing point (WSAD).

After thinking long and hard about this with my Algebra 2 level math skills, I've came up with this solution. I have two angles, one for looking left and right, one for looking up and down. When the mouse moves up, the second angle variable is increased, when its moved down the second angle variable is decreased and so on.

Right now I'm just trying to get it so changing my viewing works (using the mouse, not the keyboard). Here's my mathematical analysis of the situation:

* 1

| \

| \

| 2 \ 3

*------*

Offset

Point 1 is the viewing, point 2 is the position, and point 3 is the offset (2 for right now). I'm thinking since I have two angle variables, I'll need to have two of those triangles (to satisfy the 3 dimensions).

When the mouse is moved UP, the viewing angle 2 is incremented. Then later I would do something like viewing.x += cos(angle2) * OFFSET (2)

the viewing.y += sin(angle2) * OFFSET (2)

I know thats how it works when dealing with a two dimensional plane, but how do I deal with the 3 dimensional movement? Thanks a bunch and especially thanks for listening to my unclear rambling.

After thinking long and hard about this with my Algebra 2 level math skills, I've came up with this solution. I have two angles, one for looking left and right, one for looking up and down. When the mouse moves up, the second angle variable is increased, when its moved down the second angle variable is decreased and so on.

Right now I'm just trying to get it so changing my viewing works (using the mouse, not the keyboard). Here's my mathematical analysis of the situation:

* 1

| \

| \

| 2 \ 3

*------*

Offset

Point 1 is the viewing, point 2 is the position, and point 3 is the offset (2 for right now). I'm thinking since I have two angle variables, I'll need to have two of those triangles (to satisfy the 3 dimensions).

When the mouse is moved UP, the viewing angle 2 is incremented. Then later I would do something like viewing.x += cos(angle2) * OFFSET (2)

the viewing.y += sin(angle2) * OFFSET (2)

I know thats how it works when dealing with a two dimensional plane, but how do I deal with the 3 dimensional movement? Thanks a bunch and especially thanks for listening to my unclear rambling.