示例#1
0
 protected override void OnConstraintUpdate()
 {
     if (this.constrainScale)
     {
         this.SetWorldScale(base.target);
     }
     if (this.constrainRotation)
     {
         this.xform.rotation = base.target.rotation;
         UnityConstraints.MaskOutputRotations(this.xform, this.output);
     }
     if (this.constrainPosition)
     {
         this.pos = this.xform.position;
         if (this.outputPosX)
         {
             this.pos.x = base.target.position.x;
         }
         if (this.outputPosY)
         {
             this.pos.y = base.target.position.y;
         }
         if (this.outputPosZ)
         {
             this.pos.z = base.target.position.z;
         }
         this.xform.position = this.pos;
     }
 }
 private void OutputRotationTowards(Quaternion destRot)
 {
     if (!this.constrainRotation)
     {
         return;
     }
     UnityConstraints.InterpolateRotationTo(this.xform, destRot, this.interpolation, this.rotationSpeed);
     UnityConstraints.MaskOutputRotations(this.xform, this.output);
 }
示例#3
0
 /// <summary>
 /// Runs when the noTarget mode is set to ReturnToDefault
 /// </summary>
 protected override void NoTargetDefault()
 {
     UnityConstraints.InterpolateLocalRotationTo
     (
         this.xform,
         Quaternion.identity,
         this.interpolation,
         this.speed
     );
 }
示例#4
0
        /// <summary>
        /// Runs when the constraint is active or when the noTarget mode is set to
        /// ReturnToDefault
        /// </summary>
        private void OutputTowards(Quaternion destRot)
        {
            UnityConstraints.InterpolateRotationTo
            (
                this.xform,
                destRot,
                this.interpolation,
                this.speed
            );

            UnityConstraints.MaskOutputRotations(this.xform, this.output);
        }
示例#5
0
        /// <summary>
        ///     Runs when the constraint is active or when the noTarget mode is set to
        ///     ReturnToDefault
        /// </summary>
        private void OutputTowards(Quaternion destRot)
        {
            UnityConstraints.InterpolateRotationTo
            (
                xform,
                destRot,
                interpolation,
                speed
            );

            UnityConstraints.MaskOutputRotations(xform, output);
        }
        /// <summary>
        /// Runs when the constraint is active or when the noTarget mode is set to
        /// ReturnToDefault
        /// </summary>
        private void OutputRotationTowards(Quaternion destRot)
        {
            // Faster exit if nothing to do.
            if (!this.constrainRotation)
            {
                return;
            }

            UnityConstraints.InterpolateRotationTo
            (
                this.transform,
                destRot,
                this.interpolation,
                this.rotationSpeed
            );

            UnityConstraints.MaskOutputRotations(this.transform, this.output);
        }
示例#7
0
        /// <summary>
        ///     Runs when the constraint is active or when the noTarget mode is set to
        ///     ReturnToDefault
        /// </summary>
        private void OutputRotationTowards(Quaternion destRot)
        {
            // Faster exit if nothing to do.
            if (!constrainRotation)
            {
                return;
            }

            UnityConstraints.InterpolateRotationTo
            (
                xform,
                destRot,
                interpolation,
                rotationSpeed
            );

            UnityConstraints.MaskOutputRotations(xform, output);
        }
示例#8
0
        /// <summary>
        ///     Runs each frame while the constraint is active
        /// </summary>
        protected override void OnConstraintUpdate()
        {
            // Note: Do not run base.OnConstraintUpdate. It is not implimented
            if (!target)
            {
                return;
            }

            if (constrainScale)
            {
                SetWorldScale(target);
            }

            if (constrainRotation)
            {
                xform.rotation = target.rotation;
                UnityConstraints.MaskOutputRotations(xform, output);
            }

            if (constrainPosition)
            {
                pos = xform.position + positionOffset;

                // Output only if wanted
                if (outputPosX)
                {
                    pos.x = target.position.x + positionOffset.x;
                }
                if (outputPosY)
                {
                    pos.y = target.position.y + positionOffset.y;
                }
                if (outputPosZ)
                {
                    pos.z = target.position.z + positionOffset.z;
                }

                xform.position = pos;
            }
        }
        /// <summary>
        /// Runs each frame while the constraint is active
        /// </summary>
        protected override void OnConstraintUpdate()
        {
            // Note: Do not run base.OnConstraintUpdate. It is not implimented

            if (this.constrainScale)
            {
                this.SetWorldScale(target);
            }

            if (this.constrainRotation)
            {
                this.transform.rotation = this.target.rotation;
                UnityConstraints.MaskOutputRotations(this.transform, this.output);
            }

            if (this.constrainPosition)
            {
                this.pos = this.transform.position;

                // Output only if wanted
                if (this.outputPosX)
                {
                    this.pos.x = this.target.position.x;
                }
                if (this.outputPosY)
                {
                    this.pos.y = this.target.position.y;
                }
                if (this.outputPosZ)
                {
                    this.pos.z = this.target.position.z;
                }

                this.transform.position = pos;
            }
        }