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

Question How is AnimationJobBinder.Update meant to be used?

Discussion in 'Animation Rigging' started by tonycoculuzzi, Aug 3, 2021.

  1. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    301
    I'm currently creating a somewhat complex custom rig constraint for modifying bone transforms. This is what I'm using for my AnimationJobBinder.Update:

    Code (CSharp):
    1.  
    2. public override void Update(Job job, ref Data data)
    3. {
    4.    base.Update(job, ref data);
    5.  
    6.    job.Scale = data.actor.Definition.Scale;
    7.  
    8.    job.HeadScale = data.actor.Definition.HeadScale;
    9.    job.NeckLength = data.actor.Definition.NeckLength;
    10.  
    11.    job.SpineLength = data.actor.Definition.SpineLength;
    12.    job.UpperSpineWidth = data.actor.Definition.UpperSpineWidth;
    13.    job.UpperSpineThickness = data.actor.Definition.UpperSpineThickness;
    14.    job.MidSpineThickness = data.actor.Definition.MidSpineThickness;
    15.    job.LowerSpineThickness = data.actor.Definition.LowerSpineThickness;
    16.  
    17.    job.ClavicleDistance = data.actor.Definition.ClavicalDistance;
    18.    job.ArmDistance = data.actor.Definition.ArmDistance;
    19.    job.ArmLength = data.actor.Definition.ArmLength;
    20.    job.UpperArmThickness = data.actor.Definition.UpperArmThickness;
    21.    job.LowerArmThickness = data.actor.Definition.LowerArmThickness;
    22.  
    23.    job.LegDistance = data.actor.Definition.LegDistance;
    24.    job.LegLength = data.actor.Definition.LegLength;
    25.    job.UpperLegThickness = data.actor.Definition.UpperLegThickness;
    26.    job.LowerLegThickness = data.actor.Definition.LowerLegThickness;
    27. }
    28.  
    However, this doesn't update the properties in my Job. I assume because the Job is a struct. I'm not quite sure how I'd go about updating these job properties. Does anyone know why this wouldn't be working?

    All these properties exist in the Job struct, as regular Float and Vector3 fields. Is there another way I should be approaching this?


    Side note: The custom RigConstraint documentation is non-existent, which makes the whole process quite frustrating.

    Edit: I should mention, I believe my constraint has been set up correctly. Everything seems to be working correctly except for getting the updated values in my Job