Hi, I want to dissable the pitch rotation so I can only rotate around the box with the yaw and look up and down with the roll.
I reset the pitch each frame but for some reason I don't get what I want.
Must the box be rotated?
also is it possible that the rotate origin for the camera is the camera position itself? (like you look around with your eyes).
In other words I want first person flight..
Code:import peasy.*;
import processing.opengl.*;
PeasyCam cam;
void setup(){
size(1000, 1000, OPENGL);
smooth();
fill(255, 255, 255);
cam = new PeasyCam(this, 100);
cam.lookAt(0,0,0);
cam.setMinimumDistance(500);
cam.setMaximumDistance(2000);
noStroke();
}
void draw(){
lights();
float[] rotations = cam.getRotations(); // x, y, and z rotations required to face camera in model space
//println(rotations);
cam.setRotations(-1.0, rotations[1], rotations[2]); // rotations are applied in that order
//camera.setRotations(double pitch, double yaw, double roll); // rotations are applied in that order
pushMatrix();
translate(-500, -500, 0);
background(204);
beginShape(); //vloer
vertex(0, 0);
vertex(1000, 0);
vertex(1000, 800);
vertex(0, 800);
endShape();
beginShape();//links
vertex(0, 800, 450);
vertex(0, 0, 450);
vertex(0, 0, 0);
vertex(0, 800, 0);
endShape();
beginShape();//rechts
vertex(1000, 800, 450);
vertex(1000, 0, 450);
vertex(1000, 0, 0);
vertex(1000, 800, 0);
endShape();
beginShape();
vertex(0, 0, 450);
vertex(1000, 0, 450);
vertex(1000, 0, 0);
vertex(0, 0, 0);
endShape();
beginShape();
vertex(0, 800, 450);
vertex(1000, 800, 450);
vertex(1000, 800, 0);
vertex(0, 800, 0);
endShape();
popMatrix();
}