docs.unity.cn
    Show / Hide Table of Contents

    Struct LocalToWorld

    The local-to-world transformation matrix for an entity

    Namespace: Unity.Transforms
    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.

    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Wednesday, June 21, 2023