The CameraInfoModule
class provides access to details about the device camera.
//============================================================================== // The following example demonstrates how to hide an object when capturing a // photo or recording a video. // // Project setup: // - Insert a plane //============================================================================== // Load in the required modules const CameraInfo = require('CameraInfo'); const Scene = require('Scene'); // Enable async/await in JS [part 1] (async function() { // Locate the plane in the Scene const [plane] = await Promise.all([ Scene.root.findFirst('plane0') ]); //============================================================================== // Hide the plane when capturing a photo or recording a video //============================================================================== // Store references to the photo capture and video recording boolean signals const isCapturingPhoto = CameraInfo.isCapturingPhoto; const isRecordingVideo = CameraInfo.isRecordingVideo; // Create a boolean signal that returns true if either boolean signal are true const hidePlane = isCapturingPhoto.or(isRecordingVideo); // Bind the hidePlane signal to the hidden property of the plane plane.hidden = hidePlane; // Enable async/await in JS [part 2] })();
Property | Description |
---|---|
captureDevicePosition | (get) captureDevicePosition: StringSignal Specifies a CameraPosition enum signal identifying the current camera in use on the device. |
effectSafeAreaInsets | (get) effectSafeAreaInsets: Vec4Signal Specifies a Vec4Signal indicating the insets of the effect safe area. |
isCapturingPhoto | (get) isCapturingPhoto: BoolSignal Specifies a BoolSignal that indicates whether the camera is capturing a photo. |
isRecordingVideo | (get) isRecordingVideo: BoolSignal Specifies a BoolSignal that indicates whether the camera is recording video. |
previewScreenScale | (get) previewScreenScale: ScalarSignal Specifies a ScalarSignal describing the scale of the preview's screen, i.e. the number of pixels per point. |
previewSize | (get) previewSize: Vec2Signal Specifies a Vec2Signal describing the size of the preview, in pixels. |
viewMatrix | (get) viewMatrix: TransformSignal Specifies a TransformSignal describing the transform that needs to be applied to a givenobject to transform it from world-space to view-space. It's inverse of the Camera transform. |
This module exposes no methods.
This module exposes no classes.
Enum | Description |
---|---|
CameraPosition | The CameraPosition enum describes the direction the camera is facing. |