Object of the camera
- The perspective camera
- Orthogonal camera
- The controller
Properties to be modified
- Switch to the desired camera (orthogonal/Perspective)
- Mainly set the perspective camera properties first
- The perspective camera
- position
- lookat
- fov
- up
- aspect
- The perspective camera
- Use the updateProjectionMatrix method
- Perspective camera parameters to set the orthogonal camera
- Sets the attributes of the orthogonal camera
- Orthogonal camera
- height
- up
- plane(zoom)
- Orthogonal camera
- Set the properties of the controller
- Target attribute
- Update the controller
Window resize code
- The perspective camera
camera.aspect = width / height;
camera.updateProjectionMatrix();
Copy the code
- Orthogonal camera
cameraOrtho.left = - width / 2;
cameraOrtho.right = width / 2;
cameraOrtho.top = height / 2;
cameraOrtho.bottom = - height / 2;
cameraOrtho.updateProjectionMatrix();
Copy the code