We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › disable pitch + have Peasycam rotate center camera
Page Index Toggle Pages: 1
disable pitch + have Peasycam rotate center camera (Read 445 times)
disable pitch + have Peasycam rotate center camera
Apr 20th, 2009, 3:21pm
 
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).

...

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();

}
Re: disable pitch + have Peasycam rotate center camera
Reply #1 - Apr 20th, 2009, 6:51pm
 
I'd also like a first person flight mode for Peasycam. Smiley
I also could not get the setRotations to work, even after converting to double.  This question might be better addressed under "Other libraries".
Re: disable pitch + have Peasycam rotate center camera
Reply #2 - Apr 21st, 2009, 2:45am
 
k, new topic here:

http://processing.org/discourse/yabb2/?num=1240307112
Page Index Toggle Pages: 1