docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct LocalTransform

    Position, rotation and scale of this entity, relative to the parent, or in world space, if no parent exists.

    Implements
    IComponentData
    IQueryTypeParameter
    Namespace: Unity.Transforms
    Assembly: Unity.Transforms.dll
    Syntax
    public struct LocalTransform : IComponentData, IQueryTypeParameter
    Remarks

    If the entity has a Parent component, LocalTransform is relative to that parent. Otherwise, it is in world space.

    Fields

    Name Description
    Identity

    The identity transform.

    Position

    The position of this transform.

    Rotation

    The rotation of this transform.

    Scale

    The uniform scale of this transform.

    Methods

    Name Description
    ApplyScale(float)

    Scales this transform by the specified factor.

    Equals(in LocalTransform)

    Checks if a transform has equal position, rotation, and scale to another.

    Forward()

    Gets the forward vector of unit length.

    FromMatrix(float4x4)

    Returns the Transform equivalent of a float4x4 matrix.

    FromMatrixSafe(float4x4)

    Returns the Transform equivalent of a float4x4 matrix. Throws and exception if the matrix contains nonuniform scale or shear.

    FromPosition(float, float, float)

    Returns a Transform initialized with the given position. Rotation will be identity, and scale will be 1.

    FromPosition(float3)

    Returns a Transform initialized with the given position. Rotation will be identity, and scale will be 1.

    FromPositionRotation(float3, quaternion)

    Returns a Transform initialized with the given position and rotation. Scale will be 1.

    FromPositionRotationScale(float3, quaternion, float)

    Returns a Transform initialized with the given position, rotation and scale.

    FromRotation(quaternion)

    Returns a Transform initialized with the given rotation. Position will be 0,0,0, and scale will be 1.

    FromScale(float)

    Returns a Transform initialized with the given scale. Position will be 0,0,0, and rotation will be identity.

    Inverse()

    Gets the inverse of this transform.

    InverseTransformDirection(float3)

    Transforms a direction by the inverse of this transform.

    InverseTransformPoint(float3)

    Transforms a point by the inverse of this transform.

    InverseTransformRotation(quaternion)

    Transforms a rotation by the inverse of this transform.

    InverseTransformScale(float)

    Transforms a scale by the inverse of this transform.

    InverseTransformTransform(in LocalTransform)

    Transforms a LocalTransform by the inverse of this transform.

    Right()

    Gets the right vector of unit length.

    Rotate(quaternion)

    Rotates this Transform by the specified quaternion.

    RotateX(float)

    Rotates this Transform around the X axis.

    RotateY(float)

    Rotates this Transform around the Y axis.

    RotateZ(float)

    Rotates this Transform around the Z axis.

    ToInverseMatrix()

    Gets the float4x4 equivalent of the inverse of this transform.

    ToMatrix()

    Gets the float4x4 equivalent of this transform.

    ToString()

    Convert transformation data to a human-readable string

    TransformDirection(float3)

    Transforms a direction by this transform.

    TransformPoint(float3)

    Transforms a point by this transform.

    TransformRotation(quaternion)

    Transforms a rotation by this transform.

    TransformScale(float)

    Transforms a scale by this transform.

    TransformTransform(in LocalTransform)

    Transforms a Transform by this transform.

    Translate(float3)

    Translates this transform by the specified vector.

    Up()

    Gets the up vector of unit length.

    WithPosition(float, float, float)

    Creates a transform that is identical but with a new position value.

    WithPosition(float3)

    Gets an identical transform with a new position value.

    WithRotation(quaternion)

    Gets an identical transform with a new rotation value.

    WithScale(float)

    Gets an identical transform with a new scale value.


    Did you find this page useful? Please give it a rating:

    Thanks for rating this page!

    Report a problem on this page

    What kind of problem would you like to report?

    • This page needs code samples
    • Code samples do not work
    • Information is missing
    • Information is incorrect
    • Information is unclear or confusing
    • There is a spelling/grammar error on this page
    • Something else

    Thanks for letting us know! This page has been marked for review based on your feedback.

    If you have time, you can provide more information to help us fix the problem faster.

    Provide more information

    You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:

    You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:

    You've told us there is information missing from this page. Please tell us more about what's missing:

    You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:

    You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:

    You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:

    You've told us this page has a problem. Please tell us more about what's wrong:

    Thank you for helping to make the Unity documentation better!

    Your feedback has been submitted as a ticket for our documentation team to review.

    We are not able to reply to every ticket submitted.

    In This Article
    • Fields
    • Methods
    Back to top
    Copyright © 2025 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)