Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Avatar body mask

Discussion in 'Animation' started by Curkovic, Nov 27, 2014.

  1. Curkovic

    Curkovic

    Joined:
    Nov 5, 2014
    Posts:
    4
    Is it possible to access avatar body mask data through script? I would like to read which parts of mask are 0 which are 1.
     
    DuoPegla likes this.
  2. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    No it not possible, what is your user case exactly, maybe there is another way to achieve what you want.
     
  3. Curkovic

    Curkovic

    Joined:
    Nov 5, 2014
    Posts:
    4
    I wanted to use avatar mask outside animator as helper data structure for storing which part of rig will be completely controlled by animation and witch one will be controlled by forward kinematics from script (decision made in LateUpdate). I've written enum with bitmask to achieve that. This way around solution is necessary because base layer in animator is overriding all rotations set in Update. If base layer wouldn't override this data, partial animation could be achieved by setting avatar mask in upper layers. So real problem actually lays in animator logic. Is there reason why base layer force rig into "muscle default pose" when using a mask with all parts disabled?
     
    theANMATOR2b likes this.
  4. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    This is by design, if you want to override any transform animated by an animator you must do it in LateUpdate.

    This is by design too, when there is no animation for a transform the default value for this transform muscle are 0 which is the relax pose as you see it in the avatar's muscle configuration.

    So I don't understand why you would need the avatar mask to achieve this, your base layer animated all the transforms and then in your LateUpdate you can override any transforms as you like.
     
    theANMATOR2b likes this.
  5. Curkovic

    Curkovic

    Joined:
    Nov 5, 2014
    Posts:
    4
    I understand it is by design and overriding is currently only solution. My problem lies in blending between custom live (real-time generated) animation and mecanim animation (fade in, fade out, etc.). Blending must be custom made (in late update) and I would like to use mecanim blending features, believing the execution flow is logically better and more optimized in the end.

    If I understood right, there is no way to avoid animator forcing relax pose (not changing joints rotations in update)?

    I had idea to create animation clip live from data and push it to animator but I couldn't find any documentation how many and which curves should be passed into clip to make it possible. I see there is only setCurve method and getCurve is not there to study how standard animation clip looks like.