Reference createCamera()

createCamera()

Creates a new p5.Camera object and sets it as the current (active) camera.

The new camera is initialized with a default position (0, 0, 800) and a default perspective projection. Its properties can be controlled with p5.Camera methods such as myCamera.lookAt(0, 0, 0).

Note: Every 3D sketch starts with a default camera initialized. This camera can be controlled with the functions camera(), perspective(), ortho(), and frustum() if it's the only camera in the scene.

Note: createCamera() can only be used in WebGL mode.

Examples

Returns

p5.Camera: the new camera.
Notice any errors or typos? Please let us know. Please feel free to edit src/webgl/p5.Camera.js and open a pull request!

Related References