A class to describe a camera for viewing a 3D sketch.
Each p5.Camera
object represents a camera that views a section of 3D space. It stores information about the camera’s position, orientation, and projection.
In WebGL mode, the default camera is a p5.Camera
object that can be controlled with the camera(), perspective(), ortho(), and frustum() functions. Additional cameras can be created with createCamera() and activated with setCamera().
Note: p5.Camera
’s methods operate in two coordinate systems:
- The “world” coordinate system describes positions in terms of their relationship to the origin along the x-, y-, and z-axes. For example, calling
myCamera.setPosition()
places the camera in 3D space using "world" coordinates. - The "local" coordinate system describes positions from the camera's point of view: left-right, up-down, and forward-backward. For example, calling
myCamera.move()
moves the camera along its own axes.
Notice any errors or typos? Please let us know. Please feel free to edit src/webgl/p5.Camera.js and open a pull request!