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 & HelpOther Libraries › disable pitch + have Peasycam rotate center camera
Page Index Toggle Pages: 1
disable pitch + have Peasycam rotate center camera (Read 1198 times)
disable pitch + have Peasycam rotate center camera
Apr 21st, 2009, 2:45am
 
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();

}
Re: disable pitch + have Peasycam rotate center camera
Reply #1 - Apr 21st, 2009, 4:43am
 
Peasycam wasn't made for what you're trying to do, and the things you'd have to do with peasycam are twice as difficult as doing it with Processing's built-in camera controls.
Re: disable pitch + have Peasycam rotate center camera
Reply #2 - Apr 21st, 2009, 5:34am
 
I'd also like a first person flight mode for Peasycam. Smiley
Re: disable pitch + have Peasycam rotate center camera
Reply #3 - Apr 21st, 2009, 6:13am
 
Jon, just so you are aware, I tried to test the "cam.setRotations" since clankill3r was having trouble with it, and I also could not get the command to work.  I even switched it to double,double,double as described on your site, but it would not recognize it as a peasycam statement.  It says "The function setRotations(double, double, double) does not exist."
Page Index Toggle Pages: 1