Quark wrote on Apr 20th, 2010, 3:57am: Quote:cam.getRotations() and its value stored in a float array don't work as i expect.
Could you help me
What were you expecting
Note that angles are expressed in radians so if you were expecting degrees then you need to convert the values returned by PeasyCam to degrees see
http://processing.org/reference/degrees_.html Hi, did a quick test yesterday.
Don't know, but when i rotateX, Y, or Z using these values, rotations are not correct:
float[] rotations = cam.getRotations();
rotateX(rotations[0]);
rotateY(rotations[1]);
rotateZ(rotations[2]);
I was trying this other solution:
float[] camPos = cam.getPosition();
PVector c = new PVector(camPos[0]-0,camPos[1]-0,camPos[2]-0);
float r = sqrt(pow(c.x,2)+pow(c.y,2)+pow(c.z,2));
theta = atan2(c.y,c.x);
phi = acos(c.z/r);
then, on the the buffer:
recorder.beginDraw();
translate(width/2, height/2, 0);
rotateZ(theta);
rotateY(phi);
rotateX(-HALF_PI);
scale(16.0);
draw();
recorder.endDraw();
It's still not working as I expected....
GC