Objects in P3D look weird (clipping)

Demonstration video: HERE

I was making a first person maze game in P3D and encountered this problem. It seems like when I get too close to an object, I see through it. The camera haven’t even reached the surface of the object.

This is the code I use to control the camera:

camera(cam.x, cam.y, cam.z, cam.x+direction.x, cam.y+direction.y, cam.z+direction.z, 0, 0, -1);

Does anyone know why this happens and how to solve it?

Call this please


void avoidClipping() {
  // avoid clipping (at camera): 
  // https : // 
  // forum.processing.org/two/discussion/4128/quick-q-how-close-is-too-close-why-when-do-3d-objects-disappear
  perspective(PI/3.0, (float) width/height, 1, 1000000);
}//func 
//

1 Like

Whoa thank you! It works like magic :smiley:
I didn’t know Processing clips the scene by default.

1 Like

Some references to clipping:

And more:
clipping site:processing.org - Google Search

:)

Thank you for your information!

1 Like