Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question float3x4 TRS ? Position, Rotation Scale to float3x4 ?

Discussion in 'DOTS Animation' started by toomasio, Apr 22, 2022.

  1. toomasio

    toomasio

    Joined:
    Nov 19, 2013
    Posts:
    198
    Hello,

    I have a custom "bone" setup and I am trying to match the bone positions to the SkinMatrix. How do I convert a bone position and rotation and scale to a float3x4 in this matrix?

    Thanks,
     
  2. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,220
  3. kite3h

    kite3h

    Joined:
    Aug 27, 2012
    Posts:
    192
    0x4 : bone's X axis vector ( 0 is scale)
    1x4 : bone's Y Axis Vector( 1 is Scale)
    2x4: bone's Z Axis Vector( 2 is scale )
    3x4: Bone's Position

    matrix is 3d graphic's ABC.

    if you use Matrix4X4 ,
    Matrix4x4 localToWorld;
    float4x4 ltow = localToWorld; // type convert unity.mathmatics
    float3x4 skinmatrix = new float3x4( ltow.c0.xyz , ltow.c1.zyz , ltow.c2.xyz , ltow.c3.xyz);

    skinmatrix is the movement value from the original bone position.

    The inverse value of the original position and rotation is stored in bindposes.
    90 percent of the difficulty of skinning lies in the hierarchy.
     
    toomasio likes this.