Example #1
0
    /// <summary>
    /// Clears all sources and adds a new source with transform.
    /// </summary>
    /// <returns>The new constraint.</returns>
    public static ConstraintSource SetSource(this IConstraint constraint, Transform transform)
    {
        ConstraintSource source = new ConstraintSource();

        source.sourceTransform = transform;
        source.weight          = 1;
        constraint.SetSources(new List <ConstraintSource>());
        constraint.AddSource(source);
        return(source);
    }
    public static void SetSource(this IConstraint constraint, Transform target)
    {
        ConstraintSource source = new ConstraintSource();

        source.sourceTransform = target;
        source.weight          = 1;
        constraint.SetSources(new List <ConstraintSource>()
        {
            source
        });
    }