docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct LocalToWorld

    The local-to-world transformation matrix for an entity

    Implements
    IComponentData
    IQueryTypeParameter
    Namespace: Unity.Transforms
    Assembly: Unity.Transforms.dll
    Syntax
    [Serializable]
    public struct LocalToWorld : IComponentData, IQueryTypeParameter
    Remarks

    This matrix is primarily intended for consumption by the rendering systems.

    The matrix value is generally updated automatically by LocalToWorldSystem based on the entity's LocalTransform.

    This component value may be out of date or invalid while the SimulationSystemGroup is running; it is only updated when the TransformSystemGroup runs). It may also contain additional offsets applied for graphical smoothing purposes. Therefore, while the LocalToWorld component may be useful as a fast approximation of an entity's world-space transformation when its latency is acceptable, it should not be relied one when an accurate, up-to-date world transform is needed for simulation purposes. In those cases, use the ComputeWorldTransformMatrix(in Entity, out float4x4, ref ComponentLookup<LocalTransform>, ref ComponentLookup<Parent>, ref ComponentLookup<PostTransformMatrix>) method.

    If a system writes to this component directly outside of the Entities transform systems using a WriteGroupAttribute, LocalToWorldSystem will not overwrite this entity's matrix. In this case, the writing system is also responsible for applying the entity's PostTransformMatrix component (if present).

    Fields

    Name Description
    Value

    The transformation matrix

    Properties

    Name Description
    Forward

    The "forward" vector, in the entity's world-space.

    Position

    The "entity's" position in world-space.

    Right

    The "right" vector, in the entity's world-space.

    Rotation

    The "entity's" orientation in world-space.

    Up

    The "up" vector, in the entity's world-space.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)