Search Unity

Question How to create a NonUniformScale new MeshRenderer?

Discussion in 'Graphics for ECS' started by muntes, Feb 21, 2023.

  1. muntes

    muntes

    Joined:
    Nov 24, 2021
    Posts:
    20
    Hi,

    I want to create a simple NonUniformScale MeshRenderer Entity from the code can't figure out what I should add in the Archetype for the entity to be NonUniform.
    upload_2023-2-21_17-7-21.png

    Any ideas/directions?

    Thanks
     
  2. TRS6123

    TRS6123

    Joined:
    May 16, 2015
    Posts:
    246
    You want to add the PostTransformMatrix component. If you want to apply the effects of the transformation to the children of the entity (if it has any) you also want to add the PropagateLocalToWorld component.
     
    muntes likes this.
  3. muntes

    muntes

    Joined:
    Nov 24, 2021
    Posts:
    20
    Hi all, I solved it a few hours ago.
    I hope it's helpful: "The NonUniformScale component has been removed, and there isn't an equivalent. Non-uniform scaling isn't supported in the transform hierarchy."

    So NonUniformScale is no longer supported. It needs to be replaced with PostTransformScale.

    EntityManager.SetComponentData(entity, new PostTransformScale {Value = float3x3.Scale(localMatrix.lossyScale)});

    https://docs.unity3d.com/Packages/c...cs@1.0/manual/overview.html?q=NonUniformScale
    https://docs.unity3d.com/Packages/com.unity.physics@1.0/manual/upgrade-guide.html?q=NonUniformScale

    There is an issue with the documentation. It doesn't seem to be accessible anymore to the NonUniformScale, without the V1 transform active, and it isn't clear enough.

    Thanks for your response also @TRS6123
     
    Last edited: Feb 21, 2023