private void PopulateDictionaries()
        {
            foreach (TabPage page in this.mTabControl.TabPages)
            {
                String   label = page.Text;
                BoneType bone  = BoneType.None;


                foreach (Control c in page.Controls)
                {
                    if (c.Name == "newComboBox")
                    {
                        try
                        {
                            bone = (BoneType)Enum.Parse(typeof(BoneType),
                                                        ((c as ComboBox).SelectedItem as String));
                        }
                        catch (ArgumentException)
                        {
                            bone = (BoneType)Enum.Parse(typeof(BoneType),
                                                        ((c as ComboBox).SelectedValue as String));
                        }
                    }
                }

                if (mSensorMappings.ContainsKey(label) == false)
                {
                    mSensorMappings.Add(label, bone);
                }
                else
                {
                    mSensorMappings[label] = bone;
                }
            }
        }
Пример #2
0
        public void SetParentNode(int modelID, int boneID)
        {
            ModelBone bone = SceneManager.Current.Models[modelID].Bones[boneID];

            modelIndex = modelID;
            boneIndex  = boneID;

            type = bone.Type;

            switch (type)
            {
            case BoneType.Mesh:
                attachment = (bone.Mesh != null ? bone.Mesh.Name + ".mdl" : null);
                break;

            case BoneType.Light:
                attachment = (bone.AttachmentFile != null ? bone.AttachmentFile + ".light" : null);
                break;

            case BoneType.VFX:
                attachment = (bone.AttachmentFile != null ? bone.AttachmentFile + ".lol" : null);
                break;
            }

            ResetUI();
        }
Пример #3
0
        public void SetParentNode(int modelID, int boneID)
        {
            ModelBone bone = SceneManager.Current.Models[modelID].Bones[boneID];

            modelIndex = modelID;
            boneIndex = boneID;

            type = bone.Type;

            switch (type)
            {
                case BoneType.Mesh:
                    attachment = (bone.Mesh != null ? bone.Mesh.Name + ".mdl" : null);
                    break;

                case BoneType.Light:
                    attachment = (bone.AttachmentFile != null ? bone.AttachmentFile + ".light" : null);
                    break;

                case BoneType.VFX:
                    attachment = (bone.AttachmentFile != null ? bone.AttachmentFile + ".lol" : null);
                    break;
            }

            ResetUI();
        }
Пример #4
0
        private static List <PoseError> CompareAngleForBone(BoneType reference, PlaneBasedBodyAngles current, PlaneBasedBodyAngles target, float tolerance)
        {
            var ret = new List <PoseError>();

            foreach (var entry in target.angles[reference])
            {
                var targetAngle = entry.Value;
                var actualAngle = current.GetAngle(reference, entry.Key);
                if (!IsAngleWithinInterval(actualAngle, targetAngle, tolerance))
                {
                    //TODO calculate the error margin
                    float margin = (targetAngle - tolerance);

                    //mark the pair of bones as an error
                    var error = new PoseError(target.plane, reference, entry.Key, margin);
                    ret.Add(error);
                }
                else
                {
                    //if we need to do something when its right
                }
            }

            return(ret);
        }
Пример #5
0
        static void setBoneComponentValues
        (
            GameObjectConversionSystem gcs,
            Transform[] bones, Entity drawInstanceEntity, BoneType boneType, int instanceDataVectorLength
        )
        {
            var em = gcs.DstEntityManager;

            var boneEntities = bones
                               .Select(bone => gcs.GetPrimaryEntity(bone))
                               .ToArray();

            addComponents_(em, boneEntities);
            setDrawComponet_(em, boneEntities, drawInstanceEntity);
            setBoneId_(em, boneEntities, (int)boneType, instanceDataVectorLength);

            return;


            void addComponents_(EntityManager em_, IEnumerable <Entity> boneEntities_)
            {
                var addtypes = new ComponentTypes
                               (
                    typeof(DrawTransform.LinkData),
                    typeof(DrawTransform.IndexData),
                    typeof(DrawTransform.VectorBufferData)
                               );

                em.AddComponents(boneEntities_, addtypes);
            }

            void setDrawComponet_
                (EntityManager em_, IEnumerable <Entity> boneEntities_, Entity drawInstanceEntity_)
            {
                em_.SetComponentData(
                    boneEntities_,
                    new DrawTransform.LinkData
                {
                    DrawInstanceEntity = drawInstanceEntity_,
                }
                    );
            }

            void setBoneId_
                (EntityManager em_, IEnumerable <Entity> boneEntities_, int vectorLengthInBone_, int instanceDataVectorLength_)
            {
                var boneLength = boneEntities_.Count();

                em_.SetComponentData(boneEntities_,
                                     from i in Enumerable.Range(0, boneLength)
                                     select new DrawTransform.IndexData
                {
                    BoneId     = i,
                    BoneLength = boneLength,
                    VectorBufferOffsetOfBone = vectorLengthInBone_ * i + instanceDataVectorLength_,
                }
                                     );
            }
        }
Пример #6
0
 public static string ToAttributeString(this BoneType _this)
 {
     if (_this < BoneType.Last)
     {
         return(_this.ToString());
     }
     throw new ArgumentException(_this.ToString());
 }
Пример #7
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadEncodedInt();

            m_BoneType = (BoneType)reader.ReadEncodedInt();
        }
Пример #8
0
 public PoseError(BasePlanes reference, BoneType first, BoneType second, float error)
 {
     plane        = reference;
     boneTypes    = new BoneType[2];
     boneTypes[0] = first;
     boneTypes[1] = second;
     errorMargin  = error;
 }
Пример #9
0
 public PoseError(BoneType first, BoneType second, float error)
 {
     plane        = BasePlanes.Frontal;
     boneTypes    = new BoneType[2];
     boneTypes[0] = first;
     boneTypes[1] = second;
     errorMargin  = error;
 }
Пример #10
0
 public Bone(GraphicsDevice graphicsDevice, Bone parent, string name, BoneType type, Vector3 size, Vector3 center)
 {
     this.parent = parent;
     this.name = name;
     this.type = type;
     cube = new CubePrimitive(graphicsDevice, size, center);
     transform = Matrix.CreateScale(new Vector3(1f)) * Matrix.CreateFromQuaternion(Quaternion.Identity) * Matrix.CreateTranslation(Vector3.Zero);
     localTransform = transform;
 }
Пример #11
0
 /// <summary>
 /// Gets the bone of type and side. If more than one is found, will return the first in the array.
 /// </summary>
 public static Transform GetFirstBoneOfTypeAndSide(BoneType boneType, BoneSide boneSide, Transform[] bones)
 {
     Transform[] b = GetBonesOfTypeAndSide(boneType, boneSide, bones);
     if (b.Length == 0)
     {
         return(null);
     }
     return(b[0]);
 }
Пример #12
0
    private BoneType GetRandomBoneTypeExcept(BoneType rightBoneType)
    {
        var boneTypes = new List <BoneType>(allBoneTypes);

        boneTypes.Remove(rightBoneType);
        var index = UnityEngine.Random.Range(0, boneTypes.Count);

        return(boneTypes[index]);
    }
Пример #13
0
		/// <summary>
		/// Returns only the bones with the specified BoneType.
		/// </summary>
		public static Transform[] GetBonesOfType(BoneType boneType, Transform[] bones) {
			Transform[] r = new Transform[0];
			foreach (Transform bone in bones) {
				if (bone != null && GetBoneType(bone.name) == boneType) {
					Array.Resize(ref r, r.Length + 1);
					r[r.Length - 1] = bone;
				}
			}
			return r;
		}
Пример #14
0
 private BoneDef(BoneType type, BoneType parentType, BoneType mirrorType, JointType headJointType, JointType tailJointType, BoneDirection tPoseDirection, bool isEnd)
 {
     Type = type;
     ParentType = parentType;
     MirrorType = mirrorType;
     HeadJointType = headJointType;
     TailJointType = tailJointType;
     IsEnd = isEnd;
     TPoseDirection = tPoseDirection;
 }
Пример #15
0
    /// <summary>
    /// Call to hit this bony character.
    /// </summary>
    /// <param name="target">Attack target (LeftPoint, RightPoint or HeadPoint).</param>
    /// <param name="dropChance">Chance to drop the hit bone [0, 1].</param>
    /// <param name="stunForce">Force to apply when hitting the head to stun.</param>
    public void TakeDamage(string target, float dropChance, Vector3?stunForce = null)
    {
        stunForce = stunForce ?? Vector3.zero;

        Debug.Log($"Hit bone of type {target}.");

        var health = GetHealth();

        if (health == 1 && target == "HeadPoint")
        {
            headHasBeenHit = true;
            Die();
        }

        if (target == "HeadPoint")
        {
            Stun(stunForce.Value);
        }
        else
        {
            BoneType hitBone;
            if (target == "LeftPoint")
            {
                if (HasBone(BoneType.LeftLowerArm))
                {
                    hitBone = BoneType.LeftLowerArm;
                }
                else
                {
                    hitBone = BoneType.LeftUpperArm;
                }
            }
            // Right point \\
            else
            {
                if (HasBone(BoneType.RightLowerArm))
                {
                    hitBone = BoneType.RightLowerArm;
                }
                else
                {
                    hitBone = BoneType.RightUpperArm;
                }
            }

            // mask out the bonetype that was hit and throw it out
            bones &= ~hitBone;

            var rnd = UnityEngine.Random.Range(0, 1);
            if (rnd < dropChance)
            {
                ThrowOutBone(hitBone);
            }
        }
    }
Пример #16
0
        private void rdoType_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton rdo = (sender as RadioButton);

            if (rdo.Checked)
            {
                type = (sender as RadioButton).Tag.ToString().ToEnum <BoneType>();

                ResetUI();
            }
        }
Пример #17
0
    private float GetAlpha(BoneType type)
    {
        var hasBone = player.HasBone(type);

        if (hasBone)
        {
            return(1);
        }

        return(type == currentPickupBone ? missingPickupAlpha : 0);
    }
Пример #18
0
 public static BoneType Update(this BoneType _this, Version version)
 {
     if (!IsIncludeUpperChest(version))
     {
         if (_this >= BoneType.UpperChest)
         {
             _this++;
         }
     }
     return(_this);
 }
Пример #19
0
 //if the second bone is in the bones dictionary, checks if the angle between first and second has already been added
 private void CheckAndAddAngle(BoneType first, BoneType second, Dictionary <BoneType, Bone> bones, Vector3 planeNormal)
 {
     if (bones.ContainsKey(second))
     {
         if (GetAngle(first, second) == Mathf.Infinity)
         {
             var angle = MovementAnalyzer.Angle(bones[first], bones[second], planeNormal);
             AddAngle(first, second, angle);
         }
     }
 }
        internal Vector3 getBonePositionEnd(BoneType bone)
        {
            foreach (var kvp in mBoneTypeMapping)
            {
                if (kvp.Key == bone)
                {
                    return(kvp.Value.EndPosition);
                }
            }

            return(Vector3.Zero);
        }
Пример #21
0
 /// <summary>
 /// Returns only the bones with the specified BoneType.
 /// </summary>
 public static Transform[] GetBonesOfType(BoneType boneType, Transform[] bones)
 {
     Transform[] r = new Transform[0];
     foreach (Transform bone in bones)
     {
         if (bone != null && GetBoneType(bone.name) == boneType)
         {
             Array.Resize(ref r, r.Length + 1);
             r[r.Length - 1] = bone;
         }
     }
     return(r);
 }
 public Bone( float length, BoneType bonetype )
 {
     mLength = length;
     mStartPoint = Vector3.Zero;
     mEndPoint = Vector3.Zero;
     mChildren = new List<Bone>();
     mParentBone = null;
     mCurrentOrientation = Matrix4.Identity;
     mCalibratedOrientation = Matrix4.Identity;
     mFinalTransform = Matrix4.Identity;
     mBoneType = bonetype;
     generateBoxGeometry();
 }
Пример #23
0
 public Bone(float length, BoneType bonetype)
 {
     mLength                = length;
     mStartPoint            = Vector3.Zero;
     mEndPoint              = Vector3.Zero;
     mChildren              = new List <Bone>();
     mParentBone            = null;
     mCurrentOrientation    = Matrix4.Identity;
     mCalibratedOrientation = Matrix4.Identity;
     mFinalTransform        = Matrix4.Identity;
     mBoneType              = bonetype;
     generateBoxGeometry();
 }
        void GenerateDefaultConfig()
        {
            Logger.Warning("Could not read mapping configuration file!");
            Logger.Warning("A new one will have to be generated!");

            BoneType current = BoneType.ArmUpperL;

            foreach (Sensor sensy in mNexus.getAllSensors())
            {
                mSensorMappings[sensy.Id] = current;
                ++current;
            }
        }
Пример #25
0
        static public void CreateDrawInstanceEntities
        (
            this GameObjectConversionSystem gcs, GameObject top, GameObject main,
            Transform[] bones, BoneType boneType, int instanceDataVectorLength = 0
        )
        {
            var em = gcs.DstEntityManager;

            var drawInstanceEntity = createDrawInstanceEntity(gcs, top, main);

            setBoneComponentValues(gcs, bones, drawInstanceEntity, boneType, instanceDataVectorLength);

            setStreamComponentValues(gcs, bones, drawInstanceEntity);
        }
Пример #26
0
		public void SetBoneType( BoneType type )
		{
			m_BoneType = type;

			switch ( type )
			{
				default:
				case BoneType.Regular: Hue = 0; break;
				case BoneType.Preserved: Hue = 2101; break;
				case BoneType.Ancient: Hue = 2105; break;
				case BoneType.Fossilized: Hue = 2112; break;
				case BoneType.Ethereal: Hue = 1409; break;
				case BoneType.Demonic: Hue = 2206; break;
			}
		}
        /// <summary>
        /// Creates a mapping between a sensor ID and a specific boneType
        /// </summary>
        /// <param name="sensorID">Sensor ID to map ("A","B",etc)</param>
        /// <param name="mapping">BoneType to map to</param>
        public void createMapping(string sensorID, BoneType mapping)
        {
            Bone mappedBone;

            if (mBoneTypeMapping.TryGetValue(mapping, out mappedBone))
            {
                /** Bonetype->bone mapping exists, create the sensor-> bone map */
                mSensorBoneMapping.Add(sensorID, mappedBone);
            }
            else
            {
                /** Bone mapping doesn't exist, error */
                throw new Exception("The requested BoneType has no mapping for this skeleton.");
            }
        }
Пример #28
0
 void _PresetBoneLocation(BoneLocation boneLocation)
 {
     _isPresetted  = true;
     _boneLocation = boneLocation;
     _boneType     = ToBoneType(boneLocation);
     _boneSide     = ToBoneSide(boneLocation);
     if (_boneType == BoneType.HandFinger)
     {
         _fingerType  = ToFingerType(boneLocation);
         _fingerIndex = ToFingerIndex(boneLocation);
     }
     else
     {
         _fingerType  = FingerType.Unknown;
         _fingerIndex = -1;
     }
     _PresetLocalAxis();
 }
Пример #29
0
        //returns the angle between first and second bones
        //retuns infinity if there is no angle between them in this PlaneBasedBodyAngles
        public float GetAngle(BoneType first, BoneType second)
        {
            if (angles.ContainsKey(first))
            {
                if (angles[first].ContainsKey(second))
                {
                    return(angles[first][second]);
                }
            }
            else if (angles.ContainsKey(second))
            {
                if (angles[second].ContainsKey(first))
                {
                    return(angles[second][first]);
                }
            }

            return(Mathf.Infinity);
        }
Пример #30
0
        public void SetBoneType(BoneType type)
        {
            m_BoneType = type;

            switch (type)
            {
            default:
            case BoneType.Regular: Hue = 0; break;

            case BoneType.Preserved: Hue = 2101; break;

            case BoneType.Ancient: Hue = 2105; break;

            case BoneType.Fossilized: Hue = 2112; break;

            case BoneType.Ethereal: Hue = 1409; break;

            case BoneType.Demonic: Hue = 2206; break;
            }
        }
Пример #31
0
    private void ThrowOutBone(BoneType type)
    {
        var angle     = UnityEngine.Random.Range(0, 2 * Mathf.PI);
        var dir       = new Vector3(Mathf.Cos(angle), boneDropElevation, Mathf.Sin(angle)).normalized;
        var offsetVec = dir * boneDropDistance;

        var pickup = Instantiate <GameObject>(DroppedBonePrefab, transform.position + offsetVec, Quaternion.identity);

        var rb = pickup.GetComponent <Rigidbody>();

        var pickupBone = pickup.GetComponent <Bone>();

        pickupBone.BoneType = type;
        var jointType = (JointType)UnityEngine.Random.Range(0, 3);

        pickupBone.JointType = jointType;

        var forceVec = offsetVec * boneDropForce;

        rb.AddForce(forceVec);
    }
Пример #32
0
    internal void SetPickupBone(BoneType pickupType)
    {
        UnsetPickupBone();

        currentPickupBone = pickupType;

        switch (pickupType)
        {
        case BoneType.RightLowerArm:
            currentPickupBoneImage   = rightLowerImage;
            currentPickupBoneOutline = rightLowerOutline;
            break;

        case BoneType.RightUpperArm:
            currentPickupBoneImage   = rightUpperImage;
            currentPickupBoneOutline = rightUpperOutline;
            break;

        case BoneType.LeftLowerArm:
            currentPickupBoneImage   = leftLowerImage;
            currentPickupBoneOutline = leftLowerOutline;
            break;

        case BoneType.LeftUpperArm:
            currentPickupBoneImage   = leftUpperImage;
            currentPickupBoneOutline = leftUpperOutline;
            break;

        default:
            throw new Exception();
        }

        currentPickupBoneOutline.enabled = true;
        var hasBone = player.HasBone(pickupType);
        var cc      = currentPickupBoneImage.color;
        var alpha   = hasBone ? 1 : missingPickupAlpha;

        currentPickupBoneImage.color = new Color(cc.r, cc.g, cc.b, alpha);
    }
Пример #33
0
    public void CreateBones(JointType leftJointType, JointType rightJointType, BoneType pickupBoneType)
    {
        // Create the left and right bone from the prefab and activate the bone UI
        leftBoneObj        = Instantiate <GameObject>(bonePrefab, leftBoneStartingPos.position, Quaternion.identity, transform);
        leftRectTransform  = leftBoneObj.GetComponent <RectTransform>();
        leftBone           = leftBoneObj.GetComponent <Bone>();
        leftBone.JointType = leftJointType;
        leftBone.BoneType  = pickupBoneType;
        var sprite = GetSprite(leftJointType);

        leftBone.GetComponent <RawImage>().texture = sprite;

        rightBoneObj        = Instantiate <GameObject>(bonePrefab, rightBoneStartingPos.position, Quaternion.identity, transform);
        rightRectTransform  = rightBoneObj.GetComponent <RectTransform>();
        rightBone           = rightBoneObj.GetComponent <Bone>();
        rightBone.JointType = rightJointType;
        rightBone.BoneType  = pickupBoneType;
        sprite = GetSprite(rightJointType);
        rightBone.GetComponent <RawImage>().texture = sprite;

        gameObject.SetActive(true);
    }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="k">The BoneType Key</param>
 /// <param name="v">The Sensor Value</param>
 public BoneLabelPair(String label, BoneType bone)
 {
     this.Bone = bone;
     this.SensorLabel = label;
 }
Пример #35
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadEncodedInt();

			m_BoneType = (BoneType)reader.ReadEncodedInt();
		}
Пример #36
0
 public static BoneSide GetBoneSide(string boneName) => default;                                                                                                                                                               // 0x00000001804B2B60-0x00000001804B2E90
 public static Transform GetBone(Transform[] transforms, BoneType boneType, BoneSide boneSide = BoneSide.Center /* Metadata: 0x00652D1E */, params /* 0x00000001800D4E50-0x00000001800D4E60 */ string[][] namings) => default; // 0x00000001804B33B0-0x00000001804B3440
        // testing rotation
        public Quaternion GetJointRotation(BoneType boneType)
        {
            Vector3 pos, scale;
            Quaternion rotation;

            if (testMatrix[(int)boneType] != null)
            {
                testMatrix[(int)boneType].Decompose(out scale, out rotation, out pos);

                if (scale == Vector3.Zero
                    && rotation == Quaternion.Identity)
                {
                    rotation = Quaternion.Identity;
                }
            }
            else
            {
                rotation = Quaternion.Identity;
            }

            return rotation;
        }
Пример #38
0
		public BoneFragement( BoneType type ) : base( 0x1B19 + Utility.Random( 2 ), type )
		{
			Weight = 1.0;
		}
Пример #39
0
        public static Transform[] GetBonesOfSide(BoneSide boneSide, Transform[] bones) => default;                                                                                                                                    // 0x00000001804B3440-0x00000001804B35B0

        public static Transform[] GetBonesOfTypeAndSide(BoneType boneType, BoneSide boneSide, Transform[] bones) => default;                                                                                                          // 0x00000001804B35B0-0x00000001804B3760
Пример #40
0
		public Spine( BoneType type ) : base( 0x1B1B + Utility.Random( 2 ), type )
		{
			Weight = 2.5;
		}
Пример #41
0
 public static IEnumerable<BoneDef> FindChildren(BoneType type)
 {
     return bones.Where(b => b.ParentType == type);
 }
Пример #42
0
		static void _DrawTransformGizmo( Vector3 position, ref Matrix3x3 basis, ref Vector3 cameraForward, BoneType boneType )
		{
			Vector3 column0 = basis.column0;
			Vector3 column1 = basis.column1;
			Vector3 column2 = basis.column2;

			// X Axis
			_DrawArrowGizmo( Color.red, ref position, ref column0, ref cameraForward, boneType );
			// Y Axis
			_DrawArrowGizmo( Color.green, ref position, ref column1, ref cameraForward, boneType );
			// Z Axis
			_DrawArrowGizmo( Color.blue, ref position, ref column2, ref cameraForward, boneType );
		}
Пример #43
0
		public JawBone( BoneType type ) : base( 0x1B13 + Utility.Random( 2 ), type )
		{
			Weight = 1.0;
		}
Пример #44
0
		static void _DrawArrowGizmo(
			Color color,
			ref Vector3 position,
			ref Vector3 direction,
			ref Vector3 cameraForward,
			BoneType boneType )
		{
			Vector3 nY = Vector3.Cross( cameraForward, direction );
			if( SAFBIKVecNormalize( ref nY ) ) {
				Gizmos.color = color;

				float arrowGizmoLowerLength = _ArrowGizmoLowerLength;
				float arrowGizmoLowerWidth = _ArrowGizmoLowerWidth;
				float arrowGizmoMiddleLength = _ArrowGizmoMiddleLength;
				float arrowGizmoMiddleWidth = _ArrowGizmoMiddleWidth;
				float arrowGizmoUpperLength = _ArrowGizmoUpperLength;
				float arrowGizmoThickness = _ArrowGizmoThickness;

				float gizmoScale = 1.0f;
				if( boneType == BoneType.HandFinger ) {
					gizmoScale = _ArrowGizmoFingerScale;
				}
				if( boneType == BoneType.Eye ) {
					gizmoScale = _ArrowGizmoEyeScale;
				}
				if( gizmoScale != 1.0f ) {
					arrowGizmoLowerLength = _ArrowGizmoLowerLength * gizmoScale;
					arrowGizmoLowerWidth = _ArrowGizmoLowerWidth * gizmoScale;
					arrowGizmoMiddleLength = _ArrowGizmoMiddleLength * gizmoScale;
					arrowGizmoMiddleWidth = _ArrowGizmoMiddleWidth * gizmoScale;
					arrowGizmoUpperLength = _ArrowGizmoUpperLength * gizmoScale;
					arrowGizmoThickness = _ArrowGizmoThickness * gizmoScale;
				}

				Vector3 posLower = position + direction * arrowGizmoLowerLength;
				Vector3 posMiddle = position + direction * (arrowGizmoLowerLength + arrowGizmoMiddleLength);
				Vector3 posUpper = position + direction * (arrowGizmoLowerLength + arrowGizmoMiddleLength + arrowGizmoUpperLength);

				Vector3 lowerY = nY * arrowGizmoLowerWidth;
				Vector3 middleY = nY * arrowGizmoMiddleWidth;
				Vector3 thicknessY = nY * arrowGizmoThickness;

				for( int i = 0; i < _ArrowGizmoDrawCycles; ++i ) {
					Gizmos.DrawLine( position, posLower + lowerY );
					Gizmos.DrawLine( position, posLower - lowerY );
					Gizmos.DrawLine( posLower + lowerY, posMiddle + middleY );
					Gizmos.DrawLine( posLower - lowerY, posMiddle - middleY );
					Gizmos.DrawLine( posMiddle + middleY, posUpper );
					Gizmos.DrawLine( posMiddle - middleY, posUpper );
					lowerY -= thicknessY;
					middleY -= thicknessY;
				}
			}
		}
Пример #45
0
		static void _DrawBoneGizmo( Vector3 fromPosition, Vector3 toPosition, ref Matrix3x3 basis, ref Vector3 cameraForward, BoneType boneType )
		{
			Vector3 dir = toPosition - fromPosition;
			if( SAFBIKVecNormalize( ref dir ) ) {
				Vector3 nY = Vector3.Cross( cameraForward, dir );
				if( SAFBIKVecNormalize( ref nY ) ) {
					float boneGizmoOuterLen = _BoneGizmoOuterLen;
					float boneGizmoThickness = _BoneGizmoThickness;
					if( boneType == BoneType.HandFinger ) {
						boneGizmoOuterLen = _BoneGizmoOuterLen * _BoneGizmoFingerScale;
						boneGizmoThickness = _BoneGizmoThickness * _BoneGizmoFingerScale;
					}

					Vector3 outerY = nY * boneGizmoOuterLen;
					Vector3 thicknessY = nY * boneGizmoThickness;
					Vector3 interPosition = fromPosition + dir * boneGizmoOuterLen;

					for( int i = 0; i < _BoneGizmoDrawCycles; ++i ) {
						Gizmos.color = (i < _BoneGizmoDrawCycles / 2) ? Color.black : Color.white;
						Gizmos.DrawLine( fromPosition, interPosition + outerY );
						Gizmos.DrawLine( fromPosition, interPosition - outerY );
						Gizmos.DrawLine( interPosition + outerY, toPosition );
						Gizmos.DrawLine( interPosition - outerY, toPosition );
						outerY -= thicknessY;
					}
				}
			}
		}
Пример #46
0
        private void rdoType_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton rdo = (sender as RadioButton);

            if (rdo.Checked)
            {
                type = (sender as RadioButton).Tag.ToString().ToEnum<BoneType>();

                ResetUI();
            }
        }
Пример #47
0
		public BaseBone( int itemID, BoneType type ) : base( itemID )
		{
			SetBoneType( type );
		}
Пример #48
0
		public PelvisBone( BoneType type ) : base( 0x1B15 + Utility.Random( 2 ), type )
		{
			Weight = 2.0;
		}
Пример #49
0
        public static IEnumerable<BoneDef> FindDescendants(BoneType type)
        {
            var children = FindChildren(type);

            foreach (var child in children)
            {
                yield return child;

                var descendants = FindDescendants(child.Type);

                foreach (var descendant in descendants)
                {
                    yield return descendant;
                }
            }
        }
Пример #50
0
 /// <summary>
 /// Gets the bones of type and side.
 /// </summary>
 public static Transform[] GetBonesOfTypeAndSide(BoneType boneType, BoneSide boneSide, Transform[] bones)
 {
     Transform[] bonesOfType = GetBonesOfType(boneType, bones);
     return GetBonesOfSide(boneSide, bonesOfType);
 }
Пример #51
0
 public static BoneDef Find(BoneType type)
 {
     return Array.Find(bones, b => b.Type == type);
 }
Пример #52
0
 /// <summary>
 /// Gets the bone of type and side. If more than one is found, will return the first in the array.
 /// </summary>
 public static Transform GetFirstBoneOfTypeAndSide(BoneType boneType, BoneSide boneSide, Transform[] bones)
 {
     Transform[] b = GetBonesOfTypeAndSide(boneType, boneSide, bones);
     if (b.Length == 0) return null;
     return b[0];
 }
Пример #53
0
			void _PresetBoneLocation( BoneLocation boneLocation )
			{
				_isPresetted = true;
				_boneLocation = boneLocation;
				_boneType = ToBoneType( boneLocation );
				_boneSide = ToBoneSide( boneLocation );
				if( _boneType == BoneType.HandFinger ) {
					_fingerType = ToFingerType( boneLocation );
					_fingerIndex = ToFingerIndex( boneLocation );
				} else {
					_fingerType = FingerType.Unknown;
					_fingerIndex = -1;
				}
				_PresetLocalAxis();
			}
Пример #54
0
 /// <summary>
 /// Returns the bone of type and side with additional naming parameters.
 /// </summary>
 public static Transform GetBone(Transform[] transforms, BoneType boneType, BoneSide boneSide = BoneSide.Center, params string[][] namings)
 {
     Transform[] bones = GetBonesOfTypeAndSide(boneType, boneSide, transforms);
     return GetNamingMatch(bones, namings);
 }
Пример #55
0
 public static Transform[] GetBonesOfTypeAndSide(BoneType boneType, BoneSide boneSide, Transform[] bones) => default;                                                                                                          // 0x00000001804B35B0-0x00000001804B3760
 public static Transform GetFirstBoneOfTypeAndSide(BoneType boneType, BoneSide boneSide, Transform[] bones) => default;                                                                                                        // 0x00000001804B38D0-0x00000001804B3980
Пример #56
0
 private BoneDef(BoneType type, BoneType parentType, JointType headJointType, JointType tailJointType, BoneDirection tPoseDirection)
     : this(type, parentType, headJointType, tailJointType, tPoseDirection, false)
 {
 }
Пример #57
0
		public Skull( BoneType type ) : base( 0x1AE0 + Utility.Random( 5 ), type )
		{
			Weight = 1.0;
		}
Пример #58
0
 private BoneDef(BoneType type, BoneType parentType, JointType headJointType, JointType tailJointType, BoneDirection tPoseDirection, bool isEnd)
     : this(type, parentType, type, headJointType, tailJointType, tPoseDirection, isEnd)
 {
 }
Пример #59
0
 public Bone FindBone(BoneType type)
 {
     return Bones[(int)type];
 }
        public String SensorLabel; //{ get; set; }

        #endregion Fields

        #region Constructors

        public BoneLabelPair()
        {
            this.SensorLabel = null;
            this.Bone = BoneType.Neck;
        }