Two questions:
-
I’d like to mouse freelook and be able to go forwards or backwards along my looking direction (w & s keys). I can freelook and move within a plane w /no problems but this is not what I want. I’ve included a rough outline of my code. For <> I’ve tried a composition of angles via matrix & a composition of quaternions via multiplies. No luck. When my rotX and rotY are much less than 90 degrees, things appear to work. When I get around 90 flakey things start to happen. This sounds like a gimble locking problem. Rather than dig, I was hoping somebody would be able to point me to some working code. Not sure if it’s an incorrect of viewing transform and tangent calculation or what…
-
I just parsed a quake 3 bsp file and noticed that my orientation is as if I have a 90deg roll. I wasn’t expecting this. Anybody know why is this? I’ve heard that D3D uses a different coordinate system than opengl and was wondering if this is the reason - q3 maps were made for d3d coordinates? If so, what transform is necessary?
NOTE: Using JOGL.
Any help appreciated,
Monty
////////
Vector3f position = new Vector3f();
keyboard() {
Vector3f tangent = <<what function??>>(rotX, rotY);
switch (keycode)
case ‘w’: // forward along camera tangent
position += tangent
case ‘s’: // reverse along camera tangent
position -= tangent;
}
void mouseEvent() {
if (left/right)
rotY +/-= value;
if (up/down)
rotX +/-= value;
}
display(GLAutoDrawable drawable) {
gl.rotate(rotX,1,0,0)
gl.glRotate(rotY,0,1,0);
gl.translate(posX,posY,posZ);
drawQuake faces.
}