Пример #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);
    }
Пример #2
0
        public static int AddSourceAndSetActive(
            this IConstraint constraint,
            Transform sourceTransform,
            float weight     = 1f,
            bool activeState = true)
        {
            int sourceIndex = constraint.AddSource(
                new ConstraintSource
            {
                sourceTransform = sourceTransform,
                weight          = weight
            });

            constraint.constraintActive = activeState;

            return(sourceIndex);
        }