docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method SetLocalTransform

    SetLocalTransform(float4x4)

    Sets the local (parent-relative) position, rotation, and scale to the values encoded in a 4x4 local-to-parent matrix.

    Declaration
    public void SetLocalTransform(float4x4 localToParentMatrix)
    Parameters
    Type Name Description
    float4x4 localToParentMatrix

    A matrix representing the parent-relative affine transformation.

    Remarks

    This function gives identical results to the following operations, but is more efficient:

    AffineTransform.decompose(localToParentMatrix, out float3 position, out quaternion rotation, out float3 scale);
    transformRef.LocalPosition = position;
    transformRef.LocalRotation = rotation;
    transformRef.LocalScale = scale;

    SetLocalTransform(float3, quaternion, float3)

    Sets the local (parent-relative) position, rotation, and scale to the provided values.

    Declaration
    public void SetLocalTransform(float3 position, quaternion rotation, float3 scale)
    Parameters
    Type Name Description
    float3 position

    The new parent-relative position

    quaternion rotation

    The new parent-relative rotation

    float3 scale

    The new parent-relative scale

    Remarks

    This function gives identical results to the following operations, but is more efficient:

    transformRef.LocalPosition = position;
    transformRef.LocalRotation = rotation;
    transformRef.LocalScale = scale;
    In This Article
    Back to top
    Copyright © 2026 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)