1

I am trying to make a 3D game using p5.js. I have used the 3d version before, and every time I run into this issue. If the camera gets too close to any objects I am rendering, it will get cut off by a little. This is my camera code:

camera(x, y, z, dirx, diry, dirz, 0, -1, 0);

I have a feeling that the last 3 arguments are wrong, but I am not sure.

Just so you know, the first 6 arguments are working just fine. (meaning I can look around)

NOTE: I am using noFill(); to get the outline of the cube, but the same thing happens when I don't use noFill();

Cube getting cut off: Image of Cube getting cut off

What it should look like: Image of Cube

oriont
  • 684
  • 2
  • 10
  • 25
  • The issue is that the box is clipped by the near plane of the projection. But this is not a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). Please post your code. – Rabbid76 Oct 21 '18 at 08:52

1 Answers1

0

I guess I was just getting the camera too close to the box, because it works fine when the camera gets further away.

The corner of the box was getting behind the view frustum, which is easy to avoid with collision code.

oriont
  • 684
  • 2
  • 10
  • 25