Search Unity

Question Changing constrained axes at runtime has no effect on multi aim constraint

Discussion in 'Animation Rigging' started by Kyle45, Dec 11, 2022.

  1. Kyle45

    Kyle45

    Joined:
    Apr 18, 2015
    Posts:
    10
    Hi, I am trying to turn off the x and z axes on a multi aim constraint when the player gets within 3 units of it. My code changes the bools in the inspector, but the constraint is still being applied to all three axes. I also tried rebuilding the rig after changing the data but that had no effect. Do I need to tell the job that I changed these values or something? Thanks.

    Code (CSharp):
    1.         bool val = Vector3.Distance(playerPos, transform.position) > 3f;
    2.         mainAimConst.data.constrainedXAxis = val;
    3.         mainAimConst.data.constrainedZAxis = val;