CyBBe

09-12-2000, 06:09 AM

Hi!

I have a game "engine" :P that uses "camera" movement with gluLookAt and I've got it work perfectly with the X and Z plane, but I don't know how to implant the Y axis, because I recently wanted an observer/ghost/spectator and I have to get it to work, I also need it if I want to be able to shoot...

As U all see in the code below I calculate the X and Z plane with the variable ang, but for the Y axis I use another variable that's called angy, cause I cant use the same and there's where all the problems begin... Or???

Here's how I calculate the gluLookAt on the X and Z axis:

// px = point x

// pz = point x

// ex = eye x

// ez = eye z

// pmx = point movement x

// pmz = point movement z

pmx = pmx - (sin(pi*(ang/180))*1.8);

pmz = pmz - (cos(pi*(ang/180))*1.8);

ex = ex - (sin(pi*(ang/180))*1.8);

ez = ez - (cos(pi*(ang/180))*1.8);

px = pmx + sin(deg * pi / 180) * -rad;

py = cos(degy * pi / 180) * -rad;

pz = pmz + cos(deg * pi / 180) * -rad;

gluLookAt(ex, ey, ez, px, py, pz, 0, 1, 0);

At last the question: How do I do to calculate the pmy (point movement y) point...?

Need help plz...

[This message has been edited by CyBBe (edited 09-12-2000).]

I have a game "engine" :P that uses "camera" movement with gluLookAt and I've got it work perfectly with the X and Z plane, but I don't know how to implant the Y axis, because I recently wanted an observer/ghost/spectator and I have to get it to work, I also need it if I want to be able to shoot...

As U all see in the code below I calculate the X and Z plane with the variable ang, but for the Y axis I use another variable that's called angy, cause I cant use the same and there's where all the problems begin... Or???

Here's how I calculate the gluLookAt on the X and Z axis:

// px = point x

// pz = point x

// ex = eye x

// ez = eye z

// pmx = point movement x

// pmz = point movement z

pmx = pmx - (sin(pi*(ang/180))*1.8);

pmz = pmz - (cos(pi*(ang/180))*1.8);

ex = ex - (sin(pi*(ang/180))*1.8);

ez = ez - (cos(pi*(ang/180))*1.8);

px = pmx + sin(deg * pi / 180) * -rad;

py = cos(degy * pi / 180) * -rad;

pz = pmz + cos(deg * pi / 180) * -rad;

gluLookAt(ex, ey, ez, px, py, pz, 0, 1, 0);

At last the question: How do I do to calculate the pmy (point movement y) point...?

Need help plz...

[This message has been edited by CyBBe (edited 09-12-2000).]