メインコンテンツへスキップ

Camera

Description

This component allows the user to view the world through the entity.

Properties

World Effects

PropertyTypeDefaultDescription
scalestring'responsive'Either 'responsive' or 'absolute'. responsive will return values so that the camera on frame 1 is at the origin defined via XR8.XrController.updateCameraProjectionMatrix(). absolute will return the camera, image targets, etc in meters. When using absolute the x-position, z-position, and rotation of the starting pose will respect the parameters set in XR8.XrController.updateCameraProjectionMatrix() once scale has been estimated. The y-position will depend on the camera's physical height from the ground plane.

Face Effects

PropertyTypeDefaultDescription
nearClipnumber0.1The distance from the camera of the near clip plane, i.e. the closest distance to the camera at which scene objects are visible.
farClipnumber1000The distance from the camera of the far clip plane, i.e. the farthest distance to the camera at which scene objects are visible.
FacebooleantrueWhether to show face mesh geometry.
EyesbooleanfalseWhether to show eye mesh geometry.
IrisbooleanfalseWhether to show iris mesh geometry.
MouthbooleanfalseWhether to show mouth mesh geometry.
maxDetectionsnumber1The maximum number of faces to detect. The available choices are 1, 2, or 3.
enableEarsbooleanfalseIf true, runs ear detection simultaneously with Face Effects and returns ear attachment points.

Functions

Get

Returns a read-only reference.

Example

ecs.Camera.get(world, component.eid)

Set

Ensures the component exists on the entity, then assigns the (optional) data to the component.

Example

ecs.Camera.set(world, component.eid, {
scale: 'responsive',
nearClip: 0.1,
farClip: 1000,
Face: true,
Eyes: false,
Iris: false,
Mouth: false,
maxDetections: 1,
enableEars: false
})

Mutate

Perform an update to the component within a callback function. Return true to indicate no changes made.

Example

ecs.Camera.mutate(world, component.eid, (cursor) => {
cursor.scale = 'absolute';
cursor.nearClip = 0.5;
return false;
})

Remove

Removes the component from the entity.

Example

ecs.Camera.remove(world, component.eid)

Has

Returns true if the component is present on the entity.

Example

ecs.Camera.has(world, component.eid)

Reset

Adds, or resets the component to its default state.

Example

ecs.Camera.reset(world, component.eid)

Advanced Functions

Cursor

Returns a mutable reference. Cursors are reused so only one cursor for each component can exist at a time.

Example
ecs.Camera.cursor(world, component.eid)

Acquire

Same behavior as cursor, but commit must be called after the cursor is done being used.

Example
ecs.Camera.acquire(world, component.eid)

Commit

Called after acquire. An optional third argument determines whether the cursor was mutated or not.

Example
ecs.Camera.commit(world, component.eid)
ecs.Camera.commit(world, component.eid, false)

Dirty

Mark the entity as having been mutated. Only needed in a specific case where systems are mutating data.

Example
ecs.Camera.dirty(world, component.eid)