Can somebody make an example of code for changing weight from Source Objects? I know how to change the Script Weight, But i don’t know how to change the Weight from Source Objects
I had to search a bit for this but got it to work:
MultiAimConstraint multiAnimConstraint = GetComponent<MultiAimConstraint>();
var sources = multiAnimConstraint.data.sourceObjects;
sources.SetWeight(0, 0.29f);
sources.SetWeight(1, 0.49f);
multiAnimConstraint.data.sourceObjects = sources;
Just make sure that the index is valid
using UnityEngine.Animations;
var aim = GetComponent();
ConstraintSource a = new ConstraintSource();
a.sourceTransform=transform.parent;
a.weight=1;
aim.SetSource(0,a);