Options
All
  • Public
  • Public/Protected
  • All
Menu

Provides a variety of convenience functions for transforms.

Hierarchy

  • TransformService

Index

Methods

Static cloneTree

  • Clones the entire hierarchy tree, including node. Returns the clone of node. All cloned descendants are in the new hierarchy. This function can be slow. Use it sparingly.

    Parameters

    Returns Entity

Static cloneTreeDeferred

  • Clones the entire hierarchy tree, including node. Returns the clone of node. All cloned descendants are in the new hierarchy. This function is like CloneTree, but takes an explicit entity command buffer. This function can be slow. Use it sparingly.

    Parameters

    Returns Entity

Static computeLocalMatrix

  • Computes a new local matrix of the kind produced in the TransformLocal component. This function does not use TransformLocal, and can be quite resource intensive. Use it only if the cached result in TransformLocal is not available.

    Parameters

    Returns Matrix4x4

Static computeWorldMatrix

  • Computes a new Object to World matrix of the kind produced in the TransformObjectToWorld component. This function does not use TransformObjectToWorld, and can be quite resource intensive. Use it only if the cached result in TransformLocal is not available.

    Parameters

    Returns Matrix4x4

Static computeWorldPosition

  • Computes a transform node's world position. This function uses the computeWorldMatrix function to compute the world matrix (bypassing caching), and returns the position of that.

    This function can be quite resource intensive. When possible, read the TransformObjectToWorld component instead.

    Parameters

    Returns Vector3

Static computeWorldRotation

  • Computes a transform node's world rotation. This function uses the computeWorldMatrix function to compute the world matrix (bypassing caching), and returns the rotation of that.

    This function can be quite resource intensive. When possible, read the TransformObjectToWorld component instead.

    Parameters

    Returns Quaternion

Static computeWorldScale

  • Computes a transform node's world scale. This function uses the computeWorldMatrix function to compute the world matrix (bypassing caching), and returns the scale of that.

    If the transform does not include skew, use computeWorldScaleLossy instead.

    This function can be quite resource intensive. If possible, read the TransformObjectToWorld component instead.

    Parameters

    Returns Matrix3x3

Static computeWorldScaleLossy

  • Computes a transform node's world scale. This function uses the computeWorldMatrix function to compute the world matrix (bypassing caching), and returns the scale of that.

    Because lossy scale does not include skew, it does not include enough information to recreate a full 4x4 matrix from rotation, position, and lossy scale in 3D.

    This function can be quite resource intensive. If possible, read the TransformObjectToWorld component instead.

    Parameters

    Returns Vector3

Static countChildren

  • Returns the number of children that node has. Avoid using this function in inner loops, where it can be very slow.

    Parameters

    Returns number

Static destroyTree

  • Destroys all of node's children recursively. The destroySelf parameter specifies whether to also destroy the entity along with its children. This function can be slow. Use it sparingly.

    Parameters

    Returns void

Static destroyTreeDeferred

  • Destroys all of node's children recursively. The destroySelf parameter specifies whether to also destroy the entity along with its children. This function is like DestroyTree, but takes an explicit entity command buffer. This function can be slow. Use it sparingly.

    Parameters

    Returns void

Static find

  • Finds a child entity of node with the given name. You can search deeper in the hierarchy to find a child of a child entity, a child of that child, and so on by separating the levels with forward slashes (/) in the name.

    For example Find(node, "a/b/c") is the same as Find(Find(Find(node,"a"),"b"),"c");

    Initial lookups can be slow, but are cached if successful. Failed lookups are not cached.

    Parameters

    Returns Entity

Static getChild

  • Returns a child entity at the given index. If the index is out of range, returns Entity.NONE. Note that because the order of children can change at any time, a given index does not return the same child every time. In most cases, you can obtain better results by using the Find function or caching children locally. Avoid using this function in inner loops, where it can be very slow.

    Parameters

    Returns Entity

Static localPositionFromWorldPosition

  • Inverse-transforms a position by the TransformObjectToWorld matrix. This function uses the computeWorldMatrix function to compute the world matrix (bypassing caching), then transforms by that.

    This function can be quite resource intensive. When possible, read the TransformObjectToWorld component instead.

    Parameters

    Returns Vector3

Static localRotationFromWorldRotation

  • Inverse-transforms a rotation by the TransformObjectToWorld matrix. This function uses the computeWorldMatrix function to compute the world matrix (bypassing caching), then transforms by that.

    This function can be quite resource intensive. When possible, read the TransformObjectToWorld component instead.

    Parameters

    Returns Quaternion

Static localScaleFromWorldScale

  • Inverse-transforms a scale by the TransformObjectToWorld matrix. This function uses the computeWorldMatrix function to compute the world matrix (bypassing caching), then transforms by that.

    This function can be quite resource intensive. When possible, read the TransformObjectToWorld component instead.

    Parameters

    Returns Vector3

Static removeAllChildren

  • Sets the parent of all of node's child entities to NONE. Avoid using this function in inner loops, where it can be very slow.

    Parameters

    Returns void

Static removeAllChildrenDeferred

  • Sets the parent of all of node's child entities to NONE. This function is like RemoveAllChildren, but takes an explicit entity command buffer. Avoid using this function in inner loops, where it can be very slow.

    Parameters

    Returns void

Static unlink

  • Completely removes this node from the hierarchy, and sets the parent of all of its children to NONE. Avoid using this function in inner loops, where it can be very slow.

    Parameters

    Returns void

Static unlinkDeferred

  • Completely removes this node from the hierarchy, and sets the parent of all of its children to NONE. This function is like Unlink, but takes an explicit entity command buffer. Avoid using this function in inner loops, where it can be very slow.

    Parameters

    Returns void

Static windowToWorld

  • Helper function for transforming from window to world coordinates. This only works if cameraEntity has a valid TransformObjectToWorld component. The windowPos (window position) and windowSize (window size) should be in the same coordinates. The Z coordinate is set to 0.

    Parameters

    Returns Vector3

Static worldToWindow

  • Helper function for transforming from world to window coordinates. This only works if the cameraEntity has a valid TransformObjectToWorld component. Returns windowPos (window position) and windowSize (window size) in the same coordinates.

    Parameters

    Returns Vector2

Generated using TypeDoc