I am using processing v123. Have modelX(),modelY(),modelZ() been changed/fixed/upgraded in any way? They do not act like they are "supposed" to act, unless I am using the functions incorrectly. Check out the following:
Code:
// written in processing v123
import processing.opengl.*;
void setup(){
size(500,500,OPENGL);
noFill();
}
float cx, cy, cz;
float x,y,z;
// rotate vars
float ryoffset = radians(random(360));
float rzoffset = radians(random(360));
float rinc = 0;
float radius = 150;
void draw(){
background(0);
cx = width/2;
cy = height/2;
cz = 0;
pushMatrix();
{
// overall translation (center point)
translate(cx,cy,cz);
// drawing the center
ellipse(0,0,5,5);
// some offset rotation
rotateY(ryoffset);
rotateZ(rzoffset);
// and actual rotation movement
rotateX(rinc);
// offset from center
translate(0,radius,0);
stroke(255,0,0);
// the object
box(20,20,20);
// get the location of this particular matrix, assign it to x,y,z
x = modelX(0,0,0);
y = modelY(0,0,0);
z = modelZ(0,0,0);
}
popMatrix();
// increment the rotation for animation
rinc+=.02;
// draw a line from the center to the worldpace of the matrix
stroke(0,255,255);
line(cx,cy,cz,x,y,z);
// and draw a shape
pushMatrix();
translate(x,y,z);
box(20,20,20);
popMatrix();
}
Ideally, the blue box should match the translation of the red box exactly. It does not. If I can't use modelX(),modelY(),modelZ() -- How can I get the worldspace of an object? In the code above, how can I get the worldspace of the red box? This may not be a bug, in which case a lesson would be appreciated.
Thanks!