Advertisement

Help creating a first-person maze navigator in Processing (OpenGl)?

Started by July 08, 2015 08:09 AM
2 comments, last by Hari Krishna 9 years, 5 months ago

Okay, so I have this summer course and we have to do a project in processing. I've just studied 2 years of C++ in my school, so I'm a bit new to all this 3D stuff. Our teacher suggested that me and my partner should try on a bit of a challenge for our project, and so told us to experiment with OpenGL in Processing. So we're actually planning to make a simple 3D maze with a first person camera. However, it doesn't seem to be going as planned. We figured out how to use pushmatrix and popmatrix, and made the person start off inside the cube, but we're not really sure where to go from here. Can someone help us out? I keep trying to make the person move with the camera, but it doesn't seem to work how I want it to. This is what we've done so far, and we've got a week left. Is this feasible?

int i=0;
int i2=0;
float b = 10;
void setup()
{
size(1900, 1000, OPENGL);
strokeCap(SQUARE);
background(255);
pushMatrix();
fill(225, 0, 0);
translate(width/2, height/2, 800);
box(200, 150, 400);
popMatrix();
pushMatrix();
translate((width/2)-20, height/2, 750);
box(100, 100, 10);
popMatrix();
}
void draw() {
background(255);
resetEn();
moveFW();
}
void moveFW()
{
if (keyPressed)
{
if (key=='w')
{

i2++;
}
}
}
void resetEn() {
background(255);
pushMatrix();
fill(225, 0, 0);
translate(width/2, height/2, 800+i2);
rotateY(mouseX*0.01);
box(200, 150, 400);
popMatrix();
pushMatrix();
translate((width/2)-20, height/2, 750+i2);
rotateY(mouseX*0.01);
box(100, 100, 10);
popMatrix();
}

Please don't cross-post; just pick one forum that you think best fits your topic and post there, and a moderator will move the topic if they feel it's categorized incorrectly. :)

- Jason Astle-Adams

Advertisement

Do something simpler than a 3D maze. Start by rendering a spinning cube, with the camera orbiting at an angle so all sides are eventually seen. Until you understand the basics of geometry, view transformations and rendering, the project you've chosen will simply be too much for you—especially if you have only 2 weeks in which to complete it!

We've already done that, all we need to understand is the logic behind the vector math, can you suggest a starting point to learn about that?

This topic is closed to new replies.

Advertisement