Name

modelZ

Examples
settings <- function() {
    size(100, 100, P3D)
}

draw <- function() {
    background(0)
    noStroke()
    directionalLight(153, 153, 153, 0.5, 0, -1)
    ambientLight(153, 102, 0)
    ambient(51, 26, 0)
    translate(70, 50, 0)
    sphere(30)
}
Description Returns the three-dimensional X, Y, Z position in model space. This returns the Z value for a given coordinate based on the current set of transformations (scale, rotate, translate, etc.) The Z value can be used to place an object in space relative to the location of the original point once the transformations are no longer in use.

In the example, the modelX(), modelY(), and modelZ() functions record the location of a box in space after being placed using a series of translate and rotate commands. After popMatrix() is called, those transformations no longer apply, but the (x, y, z) coordinate returned by the model functions is used to place another box in the same location.
Syntax
modelZ(x, y, z)
Parameters
xfloat: 3D x-coordinate to be mapped
yfloat: 3D y-coordinate to be mapped
zfloat: 3D z-coordinate to be mapped
Related modelX
modelY
Creative Commons License