Example #1
0
 void _PresetEffectorLocation(EffectorLocation effectorLocation)
 {
     _isPresetted      = true;
     _effectorLocation = effectorLocation;
     _effectorType     = ToEffectorType(effectorLocation);
     _effectorFlags    = _GetEffectorFlags(_effectorType);
 }
Example #2
0
        public static FingerType ToFingerType(EffectorLocation effectorLocation)
        {
            if (IsHandFingerEffectors(effectorLocation))
            {
                int value = (int)effectorLocation - (int)EffectorLocation.LeftHandThumb;
                return((FingerType)(value % 5));
            }

            return(FingerType.Unknown);
        }
Example #3
0
 public static string GetEffectorName(EffectorLocation effectorLocation)
 {
     if (effectorLocation == EffectorLocation.Root)
     {
         return("FullBodyIK");
     }
     else if (IsHandFingerEffectors(effectorLocation))
     {
         return(ToFingerType(effectorLocation).ToString());
     }
     else
     {
         return(effectorLocation.ToString());
     }
 }
Example #4
0
        public static EffectorType ToEffectorType(EffectorLocation effectorLocation)
        {
            switch (effectorLocation)
            {
            case EffectorLocation.Root:                     return(EffectorType.Root);

            case EffectorLocation.Hips:                     return(EffectorType.Hips);

            case EffectorLocation.Neck:                     return(EffectorType.Neck);

            case EffectorLocation.Head:                     return(EffectorType.Head);

            case EffectorLocation.Eyes:                     return(EffectorType.Eyes);

            case EffectorLocation.LeftKnee:         return(EffectorType.Knee);

            case EffectorLocation.RightKnee:        return(EffectorType.Knee);

            case EffectorLocation.LeftFoot:         return(EffectorType.Foot);

            case EffectorLocation.RightFoot:        return(EffectorType.Foot);

            case EffectorLocation.LeftArm:          return(EffectorType.Arm);

            case EffectorLocation.RightArm:         return(EffectorType.Arm);

            case EffectorLocation.LeftElbow:        return(EffectorType.Elbow);

            case EffectorLocation.RightElbow:       return(EffectorType.Elbow);

            case EffectorLocation.LeftWrist:        return(EffectorType.Wrist);

            case EffectorLocation.RightWrist:       return(EffectorType.Wrist);
            }

            if ((int)effectorLocation >= (int)EffectorLocation.LeftHandThumb &&
                (int)effectorLocation <= (int)EffectorLocation.RightHandLittle)
            {
                return(EffectorType.HandFinger);
            }

            return(EffectorType.Unknown);
        }
Example #5
0
        public static Side ToEffectorSide(EffectorLocation effectorLocation)
        {
            switch (effectorLocation)
            {
            case EffectorLocation.LeftKnee:         return(Side.Left);

            case EffectorLocation.RightKnee:        return(Side.Right);

            case EffectorLocation.LeftFoot:         return(Side.Left);

            case EffectorLocation.RightFoot:        return(Side.Right);

            case EffectorLocation.LeftArm:          return(Side.Left);

            case EffectorLocation.RightArm:         return(Side.Right);

            case EffectorLocation.LeftElbow:        return(Side.Left);

            case EffectorLocation.RightElbow:       return(Side.Right);

            case EffectorLocation.LeftWrist:        return(Side.Left);

            case EffectorLocation.RightWrist:       return(Side.Right);
            }

            if ((int)effectorLocation >= (int)EffectorLocation.LeftHandThumb &&
                (int)effectorLocation <= (int)EffectorLocation.LeftHandLittle)
            {
                return(Side.Left);
            }

            if ((int)effectorLocation >= (int)EffectorLocation.RightHandThumb &&
                (int)effectorLocation <= (int)EffectorLocation.RightHandLittle)
            {
                return(Side.Right);
            }

            return(Side.None);
        }
Example #6
0
            // Call from Awake() or Editor Scripts.
            // Memo: bone.transform is null yet.
            public static void Prefix(
                Effector[] effectors,
                ref Effector effector,
                EffectorLocation effectorLocation,
                bool createEffectorTransform,
                Transform parentTransform,
                Effector parentEffector = null,
                Bone bone      = null,
                Bone leftBone  = null,
                Bone rightBone = null)
            {
                if (effector == null)
                {
                    effector = new Effector();
                }

                if (!effector._isPresetted ||
                    effector._effectorLocation != effectorLocation ||
                    (int)effector._effectorType < 0 ||
                    (int)effector._effectorType >= (int)EffectorType.Max)
                {
                    effector._PresetEffectorLocation(effectorLocation);
                }

                effector._parentEffector = parentEffector;
                effector._bone           = bone;
                effector._leftBone       = leftBone;
                effector._rightBone      = rightBone;

                // Create or destroy effectorTransform.
                effector._PrefixTransform(createEffectorTransform, parentTransform);

                if (effectors != null)
                {
                    effectors[(int)effectorLocation] = effector;
                }
            }
Example #7
0
		public static FingerType ToFingerType( EffectorLocation effectorLocation )
		{
			if( IsHandFingerEffectors( effectorLocation ) ) {
				int value = (int)effectorLocation - (int)EffectorLocation.LeftHandThumb;
				return (FingerType)(value % 5);
			}

			return FingerType.Unknown;
		}
Example #8
0
		public static bool IsHandFingerEffectors( EffectorLocation effectorLocation )
		{
			int v = (int)effectorLocation;
			return v >= (int)EffectorLocation.LeftHandThumb && v <= (int)EffectorLocation.RightHandLittle;
		}
Example #9
0
		public static string GetEffectorName( EffectorLocation effectorLocation )
		{
			if( effectorLocation == EffectorLocation.Root ) {
				return "FullBodyIK";
			} else if( IsHandFingerEffectors( effectorLocation ) ) {
				return ToFingerType( effectorLocation ).ToString();
			} else {
				return effectorLocation.ToString();
			}
		}
Example #10
0
		public static Side ToEffectorSide( EffectorLocation effectorLocation )
		{
			switch( effectorLocation ) {
			case EffectorLocation.LeftKnee:		return Side.Left;
			case EffectorLocation.RightKnee:	return Side.Right;
			case EffectorLocation.LeftFoot:		return Side.Left;
			case EffectorLocation.RightFoot:	return Side.Right;

			case EffectorLocation.LeftArm:		return Side.Left;
			case EffectorLocation.RightArm:		return Side.Right;
			case EffectorLocation.LeftElbow:	return Side.Left;
			case EffectorLocation.RightElbow:	return Side.Right;
			case EffectorLocation.LeftWrist:	return Side.Left;
			case EffectorLocation.RightWrist:	return Side.Right;
			}

			if( (int)effectorLocation >= (int)EffectorLocation.LeftHandThumb &&
				(int)effectorLocation <= (int)EffectorLocation.LeftHandLittle ) {
				return Side.Left;
			}

			if( (int)effectorLocation >= (int)EffectorLocation.RightHandThumb &&
				(int)effectorLocation <= (int)EffectorLocation.RightHandLittle ) {
				return Side.Right;
			}

			return Side.None;
		}
Example #11
0
		public static EffectorType ToEffectorType( EffectorLocation effectorLocation )
		{
			switch( effectorLocation ) {
			case EffectorLocation.Root:			return EffectorType.Root;
			case EffectorLocation.Hips:			return EffectorType.Hips;
			case EffectorLocation.Neck:			return EffectorType.Neck;
			case EffectorLocation.Head:			return EffectorType.Head;
			case EffectorLocation.Eyes:			return EffectorType.Eyes;

			case EffectorLocation.LeftKnee:		return EffectorType.Knee;
			case EffectorLocation.RightKnee:	return EffectorType.Knee;
			case EffectorLocation.LeftFoot:		return EffectorType.Foot;
			case EffectorLocation.RightFoot:	return EffectorType.Foot;

			case EffectorLocation.LeftArm:		return EffectorType.Arm;
			case EffectorLocation.RightArm:		return EffectorType.Arm;
			case EffectorLocation.LeftElbow:	return EffectorType.Elbow;
			case EffectorLocation.RightElbow:	return EffectorType.Elbow;
			case EffectorLocation.LeftWrist:	return EffectorType.Wrist;
			case EffectorLocation.RightWrist:	return EffectorType.Wrist;
			}

			if( (int)effectorLocation >= (int)EffectorLocation.LeftHandThumb &&
				(int)effectorLocation <= (int)EffectorLocation.RightHandLittle ) {
				return EffectorType.HandFinger;
			}

			return EffectorType.Unknown;
		}
Example #12
0
		void _Prefix(
			ref Effector effector,
			EffectorLocation effectorLocation,
			Effector parentEffector,
			Bone[] bones )
		{
			_Prefix( ref effector, effectorLocation, parentEffector, (bones != null && bones.Length > 0) ? bones[bones.Length - 1] : null );
		}
Example #13
0
			// Call from Awake() or Editor Scripts.
			// Memo: bone.transform is null yet.
			public static void Prefix(
				Effector[] effectors,
				ref Effector effector,
				EffectorLocation effectorLocation,
				bool createEffectorTransform,
				Transform parentTransform,
				Effector parentEffector = null,
				Bone bone = null,
				Bone leftBone = null,
				Bone rightBone = null )
			{
				if( effector == null ) {
					effector = new Effector();
				}

				if( !effector._isPresetted ||
					effector._effectorLocation != effectorLocation ||
					(int)effector._effectorType < 0 ||
					(int)effector._effectorType >= (int)EffectorType.Max ) {
					effector._PresetEffectorLocation( effectorLocation );
				}
				
				effector._parentEffector = parentEffector;
				effector._bone = bone;
				effector._leftBone = leftBone;
				effector._rightBone = rightBone;

				// Create or destroy effectorTransform.
				effector._PrefixTransform( createEffectorTransform, parentTransform );

				if( effectors != null ) {
					effectors[(int)effectorLocation] = effector;
				}
			}
Example #14
0
			void _PresetEffectorLocation( EffectorLocation effectorLocation )
			{
				_isPresetted = true;
				_effectorLocation = effectorLocation;
				_effectorType = ToEffectorType( effectorLocation );
				_effectorFlags = _GetEffectorFlags( _effectorType );
			}
Example #15
0
		void _Prefix(
			ref Effector effector,
			EffectorLocation effectorLocation,
			Effector parentEffector,
			Bone bone,
			Bone leftBone = null,
			Bone rightBone = null )
		{
			Assert( _effectors != null );
			bool createEffectorTransform = this.settings.createEffectorTransform;
			Effector.Prefix( _effectors, ref effector, effectorLocation, createEffectorTransform, null, parentEffector, bone, leftBone, rightBone );
		}
Example #16
0
        public static bool IsHandFingerEffectors(EffectorLocation effectorLocation)
        {
            int v = (int)effectorLocation;

            return(v >= (int)EffectorLocation.LeftHandThumb && v <= (int)EffectorLocation.RightHandLittle);
        }
Example #17
0
		void _Prefix(
			ref Effector effector,
			EffectorLocation effectorLocation )
		{
			Assert( _effectors != null );
			bool createEffectorTransform = this.settings.createEffectorTransform;
			Assert( rootTransform != null );
			Effector.Prefix( _effectors, ref effector, effectorLocation, createEffectorTransform, rootTransform );
		}