Search Unity

Can't change values at runtime?

Discussion in 'Animation Rigging' started by calpolican, Dec 13, 2019.

  1. calpolican

    calpolican

    Joined:
    Feb 2, 2015
    Posts:
    425
    I just begun playing with the examples and noticed that changing some values at runtime had no effect. For example, if you open the Blend constrain example and change the reference to any of the blend sources, the object keeps rotating and moving up and down as if the reference to the original source was still there. Something similar happens in the Aim Constrain example if you tick or untick any axes.
    I was wondering if this is a limitation or if there's some way to force an update for this elements.
    Thanks, and congrats for the package.
     
  2. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi,

    This is by design. References to transforms in the constraints are not updated live while the constraint is evaluated, and constraint axes are setup values used by the constraint to evaluate but are not updated either.

    The constraint components shouldn't be viewed as a MonoBehaviour with and update logic, but like a data holder instead. Once the Animation Rigging Playable Graph is built, the information is owned by the graph and the component may not update the job. The best way to know if a parameter will have an effect in the graph is to see if it's animatable. Animatable parameters values are read from the job directly and are meant to be dynamic.

    Granted however, we should add more visual cues to help instruct what is dynamic and what isn't. We were thinking of greying out static properties during playmode to better help understand when a property is static. Also, this information could probably be better explained in the documentation: https://docs.unity3d.com/Packages/com.unity.animation.rigging@0.2/manual/index.html.
     
    calpolican likes this.
  3. JohnHudeski

    JohnHudeski

    Joined:
    Nov 18, 2017
    Posts:
    126
    So what do we do? I have an IK system for catching objects that doesnt work. I manually translated the ik targets to the ball but nothing works
    upload_2020-1-13_15-56-29.png
     
  4. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    What is it exactly you're doing here? Did you change the IK target game object reference in game, and then try to manually translate the target? Or is translating the target in game just doesn't have any effect?

    If it's the prior, then you can try and toggle the RigBuilder enable state to rebuild the PlayableGraph with the new values.

    For the latter, this should work granted you don't animate the IK target game object which would override the scene values.