I am trying to get my head around rotating points in a 3D space and I am not having much luck. I have this code...
Code:float a = 0;
float x=0;
float y= 0;
float z = -100;
void setup() {
size(640, 360, P3D);
stroke(255);
fill(255, 255);
}
void draw() {
background(0);
translate(width/2, height/2);
rotateY(radians(a));
point (x, y, z);
a=a+1;
if (a>360) {a=0;}
}
Which, as far as I can work out should put a point at 0, 0, -100 or 100 points away from the camera. I presumed that rotating the Z axis would make the point spin around the cameras location but it seems Y is the closest to do this.
But, when it rotates, instead of doing what I expected it to do, i.e. to rotate around the cameras position (going behind the camera and then re-appearing on the opposite side) it seems to rotate around a point off in the distance, almost as if the camera has been moved backwards by some distance from thr 0, 0, 0 position.
I am sure I am just doing something wrong but can someone help please.