Camera
Description
This component allows the user to view the world through the entity.
Properties
World Effects
Property | Type | Default | Description |
---|---|---|---|
scale | string | '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
Property | Type | Default | Description |
---|---|---|---|
nearClip | number | 0.1 | The distance from the camera of the near clip plane, i.e. the closest distance to the camera at which scene objects are visible. |
farClip | number | 1000 | The distance from the camera of the far clip plane, i.e. the farthest distance to the camera at which scene objects are visible. |
Face | boolean | true | Whether to show face mesh geometry. |
Eyes | boolean | false | Whether to show eye mesh geometry. |
Iris | boolean | false | Whether to show iris mesh geometry. |
Mouth | boolean | false | Whether to show mouth mesh geometry. |
maxDetections | number | 1 | The maximum number of faces to detect. The available choices are 1, 2, or 3. |
enableEars | boolean | false | If 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)