File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
packages/dev/core/src/Cameras Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -261,6 +261,15 @@ export class Camera extends Node {
261
261
@serialize ( )
262
262
public fov = 0.8 ;
263
263
264
+ /**
265
+ * Sets the camera's field of view in radians based on the focal length and sensor size.
266
+ * @param value the focal length of the camera in mm.
267
+ * @param sensorSize the sensor width size of the camera in mm. (default is 36mm, which is a full frame sensor)
268
+ */
269
+ public setFocalLength ( value : number , sensorSize : number = 36 ) {
270
+ this . fov = 2 * Math . atan ( sensorSize / ( 2 * value ) ) ;
271
+ }
272
+
264
273
/**
265
274
* Projection plane tilt around the X axis (horizontal), set in Radians. (default is 0)
266
275
* Can be used to make vertical lines in world space actually vertical on the screen.
You can’t perform that action at this time.
0 commit comments