MCPcopy
hub / github.com/processing/p5.js / setPosition

Method setPosition

src/webgl/p5.Camera.js:1352–1368  ·  view source on GitHub ↗

* Sets the camera’s position in "world" space without changing its * orientation. * * The parameters, `x`, `y`, and `z`, are the coordinates where the camera * should be placed. For example, calling `myCamera.setPosition(10, 20, 30)` * places the camera at coordinates `(10, 20, 30)` i

(x, y, z)

Source from the content-addressed store, hash-verified

1350 * }
1351 */
1352 setPosition(x, y, z) {
1353 const diffX = x - this.eyeX;
1354 const diffY = y - this.eyeY;
1355 const diffZ = z - this.eyeZ;
1356
1357 this.camera(
1358 x,
1359 y,
1360 z,
1361 this.centerX + diffX,
1362 this.centerY + diffY,
1363 this.centerZ + diffZ,
1364 this.upX,
1365 this.upY,
1366 this.upZ
1367 );
1368 }
1369
1370 /**
1371 * Sets the camera’s position, orientation, and projection by copying another

Callers 4

p5.Camera.jsFile · 0.80
p5.RendererGL.jsFile · 0.80
webgl.jsFile · 0.80
interactionFunction · 0.80

Calls 1

cameraMethod · 0.95

Tested by

no test coverage detected