|
Author |
Topic: translate z param values max/mins? (Read 277 times) |
|
sspboyd
|
translate z param values max/mins?
« on: Apr 16th, 2004, 12:47am » |
|
Are there maximums or minimums for the z value in the translate() function? Or am I missing something in the way z values work. steve
|
gmail.com w/ sspboyd username
|
|
|
toxi_ Guest
|
Re: translate z param values max/mins?
« Reply #1 on: Apr 16th, 2004, 1:49pm » |
|
i think to get a decent answer, you'll need to be a bit more specific with your question... the 3d space is not really limited as such, though not all values will make sense, as if you attempt to move objects behind the viewing plane of the camera, they will become warped and appear more or less random on screen. this is because proper 3d clipping is not yet implemented...
|
|
|
|
sspboyd
|
Re: translate z param values max/mins?
« Reply #2 on: Apr 16th, 2004, 8:03pm » |
|
thanks! that's starting to explains a lot for me already. here's the test code Im testing with. Code: // z value test for translation() void setup(){ //size(100,100); size(500,500); } void loop(){ background(0); translate(width/2, height/2); int zTrans = int((1.0*mouseY/height)*height); translate(0, 0, zTrans); box(10); } void mousePressed(){ println("zTrans = "+int((1.0*mouseY/height)*height)); // zTrans calculation } |
| When I use a small window size (100,100), the z translation gets wonky around 75 and up, however, when I use a bigger stage size (500,500) it happens around 419. With the bigger stage size, by the time I get to 450 the box is receeding even though the z value is still increasing. It appears to happen at about the same relative Y value to height value for each stage size. So then does the stage size determine maximum z values? steve btw: osx 10.3.3, p5 v68
|
gmail.com w/ sspboyd username
|
|
|
narain
|
Re: translate z param values max/mins?
« Reply #3 on: Apr 19th, 2004, 4:57pm » |
|
I tested with non-square screen sizes, and I think when you set size(width,height), P5 places the camera at the z-value equal to "height", looking at the origin with a 45-degree field of view. This makes sense, because if you don't do any 3D transforms, each unit on the X-Y plane will be one pixel on the screen. (Think about it.) So plain 2D stuff will work as you'd expect. I'd suggest you avoid placing objects at z-values close to or higher than the height of the screen, because the camera is somewhere around there, and nasty things will happen.
|
|
|
|
sspboyd
|
Re: translate z param values max/mins?
« Reply #4 on: Apr 20th, 2004, 7:02pm » |
|
thanks narain, that makes sense.
|
gmail.com w/ sspboyd username
|
|
|
|