I made a simple 3D project to see what it could do. I wanted to make a first-person sort of perspective. You can walk around but you are always looking in one direction. What do I have to do to get the person to turn? Thanks.
import vsync.*;
import processing.sound.*;
float x;
float y;
float z;
int w,a,s,d = 0;
void setup(){
size(displayWidth,displayHeight,P3D);
background(0);
fill(0);
stroke(255);
strokeWeight(5);
x = width/2;
y = height/2;
z = height/1.5;
}
void draw(){
background(0);
render();
println(z);
control();
}
void keyPressed(){
if(key == 'w'){
w = 1;
}
if(key == 'a'){
a = 1;
}
if(key == 's'){
s = 1;
}
if(key == 'd'){
d = 1;
}
}
void keyReleased(){
if(key == 'w'){
w = 0;
}
if(key == 'a'){
a = 0;
}
if(key == 's'){
s = 0;
}
if(key == 'd'){
d = 0;
}
}
void control(){
if(w == 1){
z += 5;
}
if(a == 1){
x += 5;
}
if(s == 1){
z -= 5;
}
if(d == 1){
x -= 5;
}
}
void render(){
translate(x,y,z);
box(40);
translate(40,0,0);
box(40);
}