We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello! I am trying to create some customised GUI. I am also using a camera() which puts all my GUI elements into 3D.
Can I link this GUI elements to the front of the camera, so it will be at same place even if camera gets moved? any other way to work around this?
This picture maybe can show what I mean:
The code, so far. I am using peasyCam but its just for easier visualisation: import peasy.*;
PeasyCam cam;
void setup(){
size(360,240,P3D);
cam = new PeasyCam(this, 100);
cam.setMinimumDistance(50);
cam.setMaximumDistance(500);
}
void draw(){
background(100);
float[] position = cam.getPosition();
float[] rotation = cam.getRotations();
pushMatrix();
translate(position[0]-90,position[1]-50,position[2]-110);
//rotateX(rotation[0]);
//rotateY(rotation[1]);
//rotateZ(rotation[2]);
textSize(10);
text(String.format("camera pos [%.1f,%.1f,%.1f]", position[0],position[1],position[2]),10,10);
popMatrix();
beginShape(POINTS);
vertex(0,-30,0);
endShape();
rect(-20,-20,40,40);
beginShape(LINES);
vertex(0,0,-20);
vertex(0,0,10);
endShape();
}
Best
A
Answers
Ok, life can be easier.... of course this problem is not new.
Since I am not sure if I can delete this post, I will leave my code for reference.
http://forum.processing.org/two/discussion/3393/2d-hud-in-3d-game
Thank you Chrisir!
I wasn't aware of the use of hint(DISABLE_DEPTH_TEST). Also, PeasyCam includes a method called beginHUD() endHUD().