AnchorSystem

AnchorSystem ⇐ MRSystem

creates and manages WebXR anchors in the MR scene.

Kind: global class
Extends: MRSystem

anchorSystem.AnchorSystem

Kind: instance class of AnchorSystem

new exports.AnchorSystem()

AnchorSystem’s default constructor including setting up event listeners for XR initialization, user interaction, and the MRPlaneManager

anchorSystem.update(deltaTime, frame)

This update function maintains the transforms of anchored entities. This overrides any other transform values set on the element when in mixed reality.

Kind: instance method of AnchorSystem

Param Type Description
deltaTime number given timestep to be used for any feature changes
frame object given frame information to be used for any feature changes

anchorSystem.attachedComponent(entity)

Called when the entity component is initialized

Kind: instance method of AnchorSystem

Param Type Description
entity object the entity being attached/initialized.

anchorSystem.updatedComponent(entity)

Called when the entity component is updated

Kind: instance method of AnchorSystem

Param Type Description
entity object the entity being updated based on the component.

anchorSystem.detachedComponent(entity)

Called when the entity component is detached

Kind: instance method of AnchorSystem

Param Type Description
entity object the entity being updated based on the component being detached.

anchorSystem.deleteAnchor(entity)

deletes anchors from the scene and removes all references to the anchored plane (if any)

Kind: instance method of AnchorSystem

Param Type Description
entity object the entity whose anchor is being deleted.

anchorSystem.createAnchor(entity, comp)

creates the anchor specified by the data-anchor-comp

Kind: instance method of AnchorSystem

Param Type Description
entity object the entity whose anchor is being created.
comp object the data component with a type value that represents the string ‘fixed’, ‘plane’, ‘floating’, etc

anchorSystem.setAppOrigin()

Sets the origin of the MRApp being touched by all systems to allow anchoring to position itself properly.

Kind: instance method of AnchorSystem

anchorSystem.updateOrigin(frame)

Updates the origin of the MRApp being touched by all systems to allow anchoring to position.

Kind: instance method of AnchorSystem

Param Type Description
frame object given frame information to be used for any feature changes (from the update(..) loop)

anchorSystem.fixed(entity)

Anchors the given entity half a meter in front of the users position at launch.

Kind: instance method of AnchorSystem

Param Type Description
entity object the entity being positioned.

anchorSystem.floating(frame)

Creates an anchor at the position specified by the user, either floating in front of them or pinned to the scene mesh

Kind: instance method of AnchorSystem

Param Type Description
frame object given frame information to be used for any feature changes (from the update(..) loop)

anchorSystem.plane(entity, comp)

Anchors the provided entity to the nearest unoccupied plane that meets the given orientation and label. each plane is currently limited to one anchor for simplicity.

Kind: instance method of AnchorSystem

Param Type Description
entity object the entity being anchored by this function.
comp object the data-component to determine the orientation and label of the associated plane

anchorSystem.adjustTransform(xrRigidTransform, origin) ⇒ object

converts the provided XRRigidTransform to a Matrix4 and adjusts it to ensure that it’s y-axis is pointing directly up and it’s z-axis is facing inward

Kind: instance method of AnchorSystem
Returns: object - a new adjusted THREE.js Matrix4

Param Type Default Description
xrRigidTransform object a THREE.js transformation matrix that we want to adjust
origin boolean false true if this is positioned at the origin or not (handles special case of div-0).

anchorSystem.matrix4ToXRRigidTransform(matrix4) ⇒ object

Converts the provided matrix4 into a webXR xompatible XRRigidTransform

Kind: instance method of AnchorSystem
Returns: object - xrRigidTransform - the converted representation of the param matrix4

Param Type Description
matrix4 object the matrix we want to convert to a XRRigidTransform

anchorSystem.multiplyQuaternionWithXRRigidTransform(quaternion, xrRigidTransform) ⇒ object

Multiplies an xr rigid transform by the provided quaternion

Kind: instance method of AnchorSystem
Returns: object - xrRigidTransform - the output of the quaternion * xrRigidTransform in the form of an xrRigidTransform

Param Type Description
quaternion object the quaternion we want to multiply with the xrRigidTransform
xrRigidTransform object the second part of the multiplication we are looking to perform.