참고 :이 내가 내려 궤도 구형 얻으려고 노력하고있는 처리 IDEY-궤도 처리 IDE에서 쥐의 변화에 따라 위에서 아래로 전락
에 있고 난 거의있어. 쥐의 변화에 따라 다음 다시 또 다시
float cameraTheta, cameraPhi, cameraRadius; //camera position in spherical coordinates
float camx, camy, camz;
void setup() {
size(500, 500, P3D);
background(255);
cameraRadius = 200.0f;
cameraTheta = 2.80;
cameraPhi = 2.0;
recomputeOrientation();
}
void draw() {
background(255);
lights();
mouseMotion();
camera(camx, camy, camz, 0, 0, 0, 0, -1, 0);
sphereDetail(10);
sphere(25);
}
void mouseMotion()
{
if (mousePressed) {
cameraTheta += (mouseX - pmouseX)*0.05;
cameraPhi += (mouseY - pmouseY)*0.05;
}
recomputeOrientation(); //update camera (x,y,z) based on (radius,theta,phi)
}
void recomputeOrientation()
{
camx = cameraRadius * sin(cameraTheta)*sin(cameraPhi);
camz = cameraRadius * -cos(cameraTheta)*sin(cameraPhi);
camy = cameraRadius * -cos(cameraPhi);
redraw();
}
는 x의 회전이 잘 작동하지만 Y 회전 정렬의 위에서 아래로 전락하고, 나는이 필요 : 이것은 내가 지금까지 무엇을 가지고 마우스가 아래로 움직일 때 마우스가 다른 방향으로 오르거나 움직이면 한 방향으로 계속 흔들 리게됩니다. 아무도 내가 이것을 알아낼 수 있도록 도와 줄 수 있습니까?