You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//drag the mouse to look around!//there's no vanishing pointfunctionsetup(){createCanvas(100,100,WEBGL);ortho(-width/2,width/2,height/2,-height/2,0,500);describe('two 3D boxes move back and forth along same plane, rotating as mouse is dragged.');}functiondraw(){background(200);orbitControl();normalMaterial();translate(0,0,500);rotateX(0.2);rotateY(-0.2);push();translate(-15,0,sin(frameCount/30)*65);box(30);pop();push();translate(15,0,sin(frameCount/30+PI)*65);box(30);pop();}
2023-12-07.10-14-19.mp4
The cause is due to translate(). This causes the cube to be drawn far up in the sky, so when you rotate the camera around the viewpoint using orbitControl(), the object disappears from view.
In the current specifications, simply calling ortho() does not change the viewpoint position as it is initially set. In this case, it will remain at 800.
Value of eye without ortho():
So, for example, by setting the far value to 1000, you can prevent the object from disappearing.
2023-12-07.10-17-16.mp4
However, I can understand why they would want to do translate(0, 0, 500). I'm just guessing since I'm not involved.
Since it is a parallel projection, I think this indicates that the appearance does not change even if the drawing position moves up or down. Probably.
However, it is also true that because of this, orbitControl() actually behaves like a bug.
Therefore, I think some kind of modification is necessary, such as cutting orbitControl(). But I don't know what kind of fix it will be.
As suggested here, I am not suggesting that you should stop using translate() and set far to 1000. The problem is the unnatural behavior of orbitControl().
However, since there is no problem with orbitControl(), I think that some other modification is necessary.
I don't understand why the eyeZ default is uniformly 800. Previously, the value should have been based on the canvas size.
Looks like it was changed in #6216. I don't understand why this was allowed. It feels unnatural to always have 800. I don't understand.
After that, it seems that a change was made to #6549 to add this translate(0,0,500). However, because of this, orbitControl() has become a bug. Was this the right solution to do? I don't know.
Most appropriate sub-area of p5.js?
p5.js version
1.9.0
Web browser and version
Chrome
Operating System
Windows11
Steps to reproduce this
Steps:
https://p5js.org/reference/#/p5/ortho
Snippet:
2023-12-07.10-14-19.mp4
The cause is due to translate(). This causes the cube to be drawn far up in the sky, so when you rotate the camera around the viewpoint using orbitControl(), the object disappears from view.
In the current specifications, simply calling ortho() does not change the viewpoint position as it is initially set. In this case, it will remain at 800.
Value of eye without ortho():
So, for example, by setting the far value to 1000, you can prevent the object from disappearing.
2023-12-07.10-17-16.mp4
However, I can understand why they would want to do translate(0, 0, 500). I'm just guessing since I'm not involved.
Since it is a parallel projection, I think this indicates that the appearance does not change even if the drawing position moves up or down. Probably.
However, it is also true that because of this, orbitControl() actually behaves like a bug.
Therefore, I think some kind of modification is necessary, such as cutting orbitControl(). But I don't know what kind of fix it will be.
As suggested here, I am not suggesting that you should stop using translate() and set far to 1000. The problem is the unnatural behavior of orbitControl().
However, since there is no problem with orbitControl(), I think that some other modification is necessary.
In addition, it seems that a similar problem occurs with perspective().
https://p5js.org/reference/#/p5/perspective
I don't understand why the eyeZ default is uniformly 800. Previously, the value should have been based on the canvas size.
Looks like it was changed in #6216. I don't understand why this was allowed. It feels unnatural to always have 800. I don't understand.
After that, it seems that a change was made to #6549 to add this translate(0,0,500). However, because of this, orbitControl() has become a bug. Was this the right solution to do? I don't know.