New problem
in
Programming Questions
•
1 year ago
I had a stupid problem. I fixed it. New problem!
Alright, I'm trying to create a first person shooter, and i've got the camera working. Is there a possible substitute for the cameraDirection?
int playerX=50;
int playerY=250;
int playerZ=250;
void setup()
{
size(500,500,P3D);
background(0);
mouseX = 250;
}
void draw()
{
background(0);
beginCamera();
camera(0.0,0.0,0.0,playerX,playerY,playerZ,0.0,1.0,0.0);
rotateY(mouseX/50);
endCamera();
int playerY=250;
int playerZ=250;
void setup()
{
size(500,500,P3D);
background(0);
mouseX = 250;
}
void draw()
{
background(0);
beginCamera();
camera(0.0,0.0,0.0,playerX,playerY,playerZ,0.0,1.0,0.0);
rotateY(mouseX/50);
endCamera();
if(mousePressed)
{
if(key == 'w')
{
playerZ == cameraDirection;
{
if(key == 'w')
{
playerZ == cameraDirection;
playerZ = playerZ+1;
}
}
if(keyPressed)
{
if(key == 's')
{
playerZ == cameraDirection;
if(key == 's')
{
playerZ == cameraDirection;
playerZ = playerZ+ -1;
}
}
}
}
This is my code right now:
int playerX=50;
int playerY=250;
int playerZ=250;
void setup()
{
size(500,500,P3D);
background(0);
mouseX = 250;
}
void draw()
{
background(0);
camera(0.0,0.0,0.0,playerX,playerY,playerZ,0.0,1.0,0.0);
rotateY(mouseX/50);
endCamera();
translate(250,250,250);
box(100);
}
int playerY=250;
int playerZ=250;
void setup()
{
size(500,500,P3D);
background(0);
mouseX = 250;
}
void draw()
{
background(0);
camera(0.0,0.0,0.0,playerX,playerY,playerZ,0.0,1.0,0.0);
rotateY(mouseX/50);
endCamera();
translate(250,250,250);
box(100);
}
The box is just so I can tell the direction
The post below was an awnser to my earlier question.
1