Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[solved] Changing TransformMatrix (Entities prev 4) to RigidTransform (Entities prev 11)

Discussion in 'Entity Component System' started by Antypodish, Sep 1, 2018.

  1. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,753
    After long fight, with multiple issues, finally managed to upgrade my project Entities package from Entities 0.0.012 prev 4 to Entities prev 11. Not the smoothest ride but seams working now.

    However, along with some changes like FixedArray to BufferArray and TransformMatrix to RigidTransform I faced next issue.

    So TransformMatrix allowed change position and rotation, using Position and Rotation components. There were no scale component. But to scale it, I simply assigned precomputed float4x4 matrix, with desired scale, position and rotation.

    Now, with RigidTransform seams I can not assign anymore float4x4, but I can set pos and rot. Hence, I can not set scale. How should I resolve this issue, so I can scale again, using RigidTransform / float4x4, or relevant?
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Scale component is coming in the next release.
     
  3. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,753
    Thx Joachim.

    Yes I am aware of that.
    I have noticed now Unity.Mathematics.RigidTransform has RigidTransform.scale ( float ). But yet unusable?
    But beyond that, means I can not have workaround for scale, until 2018.3 ?
     
  4. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,753
    Another thing

    Seams I can not do (TransformMatrix )
    Code (CSharp):
    1. commandsBuffer.AddComponent ( entity, new TransformMatrix { } ) ;
    in oppose to previously, what I could do (RigidTransform)
    Code (CSharp):
    1. commandsBuffer.AddComponent ( entity, new RigidTransform { }  ) ;
    Any reason behind?
     
  5. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
  6. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,753
    Ah superb, scale works indeed. :cool:

    Code (CSharp):
    1. commandsBuffer.AddComponent ( entity, new Position { Value = position } ) ;
    2. commandsBuffer.AddComponent ( entity, new Rotation { Value = new quaternion () } ) ;
    3. commandsBuffer.AddComponent ( entity, new Scale { Value  = new float3 ( 1, 4, 1) } ) ;
    Ah ok.

    Well, I put TransformMatrix and RigidTransform other way round post #4.
    What I meant initially that in older preview TransformMatrix worked in AddComponent. But you already explained a reason, why RigidTransform don't thx.
     
  7. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    TransformMatrix has been renamed to LocalToWorld
     
    e45240 and gandhimena_unity like this.
  8. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,753
    Thx for letting know. I suppose for now, since scale already exists, I stick with a scale. But I may need matrix in a future.