/// <summary> /// Adjusts a skeleton to reflect the DNA values from UMA character data. /// </summary> /// <remarks> /// This will set the postion, rotation, and scale of the various adjustment /// bones used by the UMA human rigs to generate a unique character shape. /// Also calculates a somewhat realistic mass for the character and the /// height and radius of their default collider. /// </remarks> /// <param name="umaData">UMA data.</param> /// <param name="skeleton">Skeleton.</param> public static void UpdateUMAGirlyMyRaceDNABones(UMAData umaData, UMASkeleton skeleton) { var umaDna = umaData.GetDna<UMADnaHumanoid>(); skeleton.SetScale(neckAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.neckThickness - 0.5f) * 0.80f, 0.5f, 1.6f), Mathf.Clamp(1 + (umaDna.neckThickness - 0.5f) * 1.2f, 0.5f, 1.6f))); skeleton.SetScale(spineAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(0.9f + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.45f, 0.75f, 1.350f), Mathf.Clamp(0.8f + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.25f, 0.75f, 1.350f))); //umaData.boneList["NeckAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.neckThickness - 0.5f) * 0.80f, 0.5f, 1.6f), //Mathf.Clamp(1 + (umaDna.neckThickness - 0.5f) * 1.2f, 0.5f, 1.6f)); }
public void AdjustScale(UMASkeleton skeleton) { if (_adjustScale) { if (skeleton.HasBone(scaleBoneHash)) { var liveScaleResult = _liveScale != -1f ? _liveScale : _scale; float finalOverallScale = skeleton.GetScale(_scaleBoneHash).x *liveScaleResult; //hmm why does this work- its supposed to be + skeleton.SetScale(_scaleBoneHash, new Vector3(finalOverallScale, finalOverallScale, finalOverallScale)); } } }
public static void UpdateRACFemaleDNABones(UMAData umaData, UMASkeleton skeleton) { if (RACHumanFemaleDNAConverterBehaviour.customisation == null) RACHumanFemaleDNAConverterBehaviour.customisation = GameObject.FindObjectOfType(typeof(RACCustomization)) as RACCustomization; HumanFemaleDNAConverterBehaviour.UpdateUMAFemaleDNABones (umaData, skeleton); List<RACModifiableControl> controls = RACHumanFemaleDNAConverterBehaviour.customisation.ControlList; for (int iSliderIndex = 0; iSliderIndex < controls.Count; ++iSliderIndex) { RACModifiableControl curControl = controls[iSliderIndex]; for (int iBodyPartIndex = 0; iBodyPartIndex < curControl.modifiedBodyParts.Length; ++iBodyPartIndex) { int skeletonStringToHash = UMASkeleton.StringToHash(curControl.modifiedBodyParts[iBodyPartIndex]); //Get the starting information Vector3 startingInformation = Vector3.zero; if (curControl.sliderStyle == RACModifiableControl.SliderStyle.POSITION) { startingInformation = skeleton.GetPosition(skeletonStringToHash); Vector3 scale = skeleton.GetScale(skeletonStringToHash); //Modify it if (curControl.effectsX) startingInformation.x += curControl.sliderControl.actualValue*(1/scale.x); if (curControl.effectsY) startingInformation.y += curControl.sliderControl.actualValue*(1/scale.y); if (curControl.effectsZ) startingInformation.z += curControl.sliderControl.actualValue*(1/scale.z); skeleton.SetPosition(skeletonStringToHash, startingInformation); } else if (curControl.sliderStyle == RACModifiableControl.SliderStyle.SCALE) { startingInformation = skeleton.GetScale(skeletonStringToHash); //Modify it if (curControl.effectsX) startingInformation.x = curControl.sliderControl.actualValue; if (curControl.effectsY) startingInformation.y = curControl.sliderControl.actualValue; if (curControl.effectsZ) startingInformation.z = curControl.sliderControl.actualValue; skeleton.SetScale(skeletonStringToHash, startingInformation); } } } }
public void GotoTPose() { if (umaRecipe.raceData.TPose != null) { var tpose = umaRecipe.raceData.TPose; tpose.DeSerialize(); for (int i = 0; i < tpose.boneInfo.Length; i++) { var bone = tpose.boneInfo[i]; var hash = UMASkeleton.StringToHash(bone.name); var go = skeleton.GetBoneGameObject(hash); if (go == null) { continue; } skeleton.SetPosition(hash, bone.position); skeleton.SetRotation(hash, bone.rotation); skeleton.SetScale(hash, bone.scale); } } }
public static void UpdateUMAMaleDNABones(UMAData umaData, UMASkeleton skeleton) { var umaDna = umaData.GetDna<UMADnaHumanoid>(); skeleton.SetScale(UMASkeleton.StringToHash("HeadAdjust"), new Vector3( Mathf.Clamp(1, 1, 1), Mathf.Clamp(1 + (umaDna.headWidth - 0.5f) * 0.30f, 0.5f, 1.6f), Mathf.Clamp(1 , 1, 1))); //umaData.boneList["HeadAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 1, 1), //Mathf.Clamp(1 + (umaDna.headWidth - 0.5f) * 0.30f, 0.5f, 1.6f), //Mathf.Clamp(1 , 1, 1)); skeleton.SetScale(UMASkeleton.StringToHash("NeckAdjust"), new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.neckThickness - 0.5f) * 0.80f, 0.5f, 1.6f), Mathf.Clamp(1 + (umaDna.neckThickness - 0.5f) * 1.2f, 0.5f, 1.6f))); //umaData.boneList["NeckAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.neckThickness - 0.5f) * 0.80f, 0.5f, 1.6f), //Mathf.Clamp(1 + (umaDna.neckThickness - 0.5f) * 1.2f, 0.5f, 1.6f)); skeleton.SetScale(UMASkeleton.StringToHash("LeftOuterBreast"), new Vector3( Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f))); skeleton.SetScale(UMASkeleton.StringToHash("RightOuterBreast"), new Vector3( Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f))); //umaData.boneList["LeftOuterBreast"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), //Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), //Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f)); //umaData.boneList["RightOuterBreast"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), //Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), //Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f)); skeleton.SetScale(UMASkeleton.StringToHash("LeftEye"), new Vector3( Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f), Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f), Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f))); skeleton.SetScale(UMASkeleton.StringToHash("RightEye"), new Vector3( Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f), Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f), Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f))); //umaData.boneList["LeftEye"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f), //Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f), //Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f)); //umaData.boneList["RightEye"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f), //Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f), //Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f)); skeleton.SetRotation(UMASkeleton.StringToHash("LeftEye"), Quaternion.Euler(new Vector3((umaDna.eyeRotation - 0.5f) * 20, -90, -180))); skeleton.SetRotation(UMASkeleton.StringToHash("RightEye"), Quaternion.Euler(new Vector3(-(umaDna.eyeRotation - 0.5f) * 20, -90, -180))); //umaData.boneList["LeftEye"].boneTransform.localEulerAngles = new Vector3((umaDna.eyeRotation - 0.5f) * 20, -90, -180); //umaData.boneList["RightEye"].boneTransform.localEulerAngles = new Vector3(-(umaDna.eyeRotation - 0.5f) * 20, -90, -180); skeleton.SetScale(UMASkeleton.StringToHash("Spine1Adjust"), new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(0.9f + (umaDna.upperWeight - 0.5f) * 0.10f + (umaDna.upperMuscle - 0.5f) * 0.5f, 0.45f, 1.50f), Mathf.Clamp(0.7f + (umaDna.upperWeight - 0.5f) * 0.45f + (umaDna.upperMuscle - 0.5f) * 0.45f, 0.55f, 1.15f))); //umaData.boneList["Spine1Adjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(0.9f + (umaDna.upperWeight - 0.5f) * 0.10f + (umaDna.upperMuscle - 0.5f) * 0.5f, 0.45f, 1.50f), //Mathf.Clamp(0.7f + (umaDna.upperWeight - 0.5f) * 0.45f + (umaDna.upperMuscle - 0.5f) * 0.45f, 0.55f, 1.15f)); skeleton.SetScale(UMASkeleton.StringToHash("SpineAdjust"), new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(0.9f + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.45f, 0.75f, 1.350f), Mathf.Clamp(0.8f + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.25f, 0.75f, 1.350f))); //umaData.boneList["SpineAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(0.9f + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.45f, 0.75f, 1.350f), //Mathf.Clamp(0.8f + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.25f, 0.75f, 1.350f)); skeleton.SetScale(UMASkeleton.StringToHash("LowerBackBelly"), new Vector3( Mathf.Clamp(1 + (umaDna.belly - 0.5f) * 1.0f, 0.35f, 1.75f), Mathf.Clamp(1 + (umaDna.belly - 0.5f) * 0.35f, 0.35f, 1.75f), Mathf.Clamp(1 + (umaDna.belly - 0.5f) * 1.25f, 0.35f, 1.75f))); //umaData.boneList["LowerBackBelly"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.belly - 0.5f) * 1.0f, 0.35f, 1.75f), //Mathf.Clamp(1 + (umaDna.belly - 0.5f) * 0.35f, 0.35f, 1.75f), //Mathf.Clamp(1 + (umaDna.belly - 0.5f) * 1.25f, 0.35f, 1.75f)); skeleton.SetScale(UMASkeleton.StringToHash("LowerBackAdjust"), new Vector3( Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.lowerWeight - 0.5f) * 0.15f, 0.85f, 1.5f), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.waist - 0.5f) * 0.45f, 0.65f, 1.75f), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.lowerWeight - 0.5f) * 0.15f, 0.85f, 1.5f))); //umaData.boneList["LowerBackAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.lowerWeight - 0.5f) * 0.15f, 0.85f, 1.5f), //Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.waist - 0.5f) * 0.45f, 0.65f, 1.75f), //Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.lowerWeight - 0.5f) * 0.15f, 0.85f, 1.5f)); skeleton.SetScale(UMASkeleton.StringToHash("LeftTrapezius"), new Vector3( Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f))); skeleton.SetScale(UMASkeleton.StringToHash("RightTrapezius"), new Vector3( Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f))); //umaData.boneList["LeftTrapezius"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), //Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), //Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f)); //umaData.boneList["RightTrapezius"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), //Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), //Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f)); skeleton.SetScale(UMASkeleton.StringToHash("LeftArmAdjust"), new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f), Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f))); skeleton.SetScale(UMASkeleton.StringToHash("RightArmAdjust"), new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f), Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f))); //umaData.boneList["LeftArmAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f), //Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f)); //umaData.boneList["RightArmAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f), //Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f)); skeleton.SetScale(UMASkeleton.StringToHash("LeftForeArmAdjust"), new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f))); skeleton.SetScale(UMASkeleton.StringToHash("RightForeArmAdjust"), new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f))); //umaData.boneList["LeftForeArmAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f), //Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f)); //umaData.boneList["RightForeArmAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f), //Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f)); skeleton.SetScale(UMASkeleton.StringToHash("LeftForeArmTwistAdjust"), new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f))); skeleton.SetScale(UMASkeleton.StringToHash("RightForeArmTwistAdjust"), new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f))); //umaData.boneList["LeftForeArmTwistAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f), //Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f)); //umaData.boneList["RightForeArmTwistAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f), //Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f)); skeleton.SetScale(UMASkeleton.StringToHash("LeftShoulderAdjust"), new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f))); skeleton.SetScale(UMASkeleton.StringToHash("RightShoulderAdjust"), new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f))); //umaData.boneList["LeftShoulderAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f), //Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f)); //umaData.boneList["RightShoulderAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f), //Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f)); skeleton.SetScale(UMASkeleton.StringToHash("LeftUpLegAdjust"), new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.45f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.15f), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.45f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.15f))); skeleton.SetScale(UMASkeleton.StringToHash("RightUpLegAdjust"), new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.45f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.15f), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.45f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.15f))); //umaData.boneList["LeftUpLegAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.45f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.15f), //Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.45f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.15f)); //umaData.boneList["RightUpLegAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.45f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.15f), //Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.45f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.15f)); skeleton.SetScale(UMASkeleton.StringToHash("LeftLegAdjust"), new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.95f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.75f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f))); skeleton.SetScale(UMASkeleton.StringToHash("RightLegAdjust"), new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.95f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.75f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f))); //umaData.boneList["LeftLegAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.95f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f), //Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.75f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f)); //umaData.boneList["RightLegAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.95f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f), //Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.75f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f)); skeleton.SetScale(UMASkeleton.StringToHash("LeftGluteus"), new Vector3( Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f), Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f), Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f))); skeleton.SetScale(UMASkeleton.StringToHash("RightGluteus"), new Vector3( Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f), Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f), Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f))); //umaData.boneList["LeftGluteus"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f), //Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f), //Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f)); //umaData.boneList["RightGluteus"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f), //Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f), //Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f)); skeleton.SetScale(UMASkeleton.StringToHash("LeftEarAdjust"), new Vector3( Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f))); skeleton.SetScale(UMASkeleton.StringToHash("RightEarAdjust"), new Vector3( Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f))); //umaData.boneList["LeftEarAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), //Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), //Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f)); //umaData.boneList["RightEarAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), //Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), //Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f)); skeleton.SetPosition(UMASkeleton.StringToHash("LeftEarAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("LeftEarAdjust")) + new Vector3( Mathf.Clamp(0 + (umaDna.headWidth - 0.5f) * -0.01f, -0.01f, 0.01f), Mathf.Clamp(0 + (umaDna.headWidth - 0.5f) * -0.03f, -0.03f, 0.03f), Mathf.Clamp(0 + (umaDna.earsPosition - 0.5f) * 0.02f, -0.02f, 0.02f))); skeleton.SetPosition(UMASkeleton.StringToHash("RightEarAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("RightEarAdjust")) + new Vector3( Mathf.Clamp(0 + (umaDna.headWidth - 0.5f) * -0.01f, -0.01f, 0.01f), Mathf.Clamp(0 + (umaDna.headWidth - 0.5f) * 0.03f, -0.03f, 0.03f), Mathf.Clamp(0 + (umaDna.earsPosition - 0.5f) * 0.02f, -0.02f, 0.02f))); //umaData.boneList["LeftEarAdjust"].boneTransform.localPosition = umaData.boneList["LeftEarAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0 + (umaDna.headWidth - 0.5f) * -0.01f, -0.01f, 0.01f), //Mathf.Clamp(0 + (umaDna.headWidth - 0.5f) * -0.03f, -0.03f, 0.03f), //Mathf.Clamp(0 + (umaDna.earsPosition - 0.5f) * 0.02f, -0.02f, 0.02f)); //umaData.boneList["RightEarAdjust"].boneTransform.localPosition = umaData.boneList["LeftEarAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0 + (umaDna.headWidth - 0.5f) * -0.01f, -0.01f, 0.01f), //Mathf.Clamp(0 + (umaDna.headWidth - 0.5f) * 0.03f, -0.03f, 0.03f), //Mathf.Clamp(0 + (umaDna.earsPosition - 0.5f) * 0.02f, -0.02f, 0.02f)); skeleton.SetRotation(UMASkeleton.StringToHash("LeftEarAdjust"), Quaternion.Euler(new Vector3( Mathf.Clamp(0, -30, 80), Mathf.Clamp(0, -30, 80), Mathf.Clamp((umaDna.earsRotation - 0.5f) * 40, -15, 40)))); skeleton.SetRotation(UMASkeleton.StringToHash("RightEarAdjust"), Quaternion.Euler(new Vector3( Mathf.Clamp(0, -30, 80), Mathf.Clamp(0, -30, 80), Mathf.Clamp((umaDna.earsRotation - 0.5f) * -40, -40, 15)))); //umaData.boneList["LeftEarAdjust"].boneTransform.localEulerAngles = new Vector3( //Mathf.Clamp(0, -30, 80), //Mathf.Clamp(0, -30, 80), //Mathf.Clamp((umaDna.earsRotation - 0.5f) * 40, -15, 40)); //umaData.boneList["RightEarAdjust"].boneTransform.localEulerAngles = new Vector3( //Mathf.Clamp(0, -30, 80), //Mathf.Clamp(0, -30, 80), //Mathf.Clamp((umaDna.earsRotation - 0.5f) * -40, -40, 15)); skeleton.SetScale(UMASkeleton.StringToHash("NoseBaseAdjust"), new Vector3( Mathf.Clamp(1 + (umaDna.noseSize - 0.5f) * 1.5f, 0.25f, 3.0f), Mathf.Clamp(1 + (umaDna.noseSize - 0.5f) * 0.15f + (umaDna.noseWidth - 0.5f) * 1.0f, 0.25f, 3.0f), Mathf.Clamp(1 + (umaDna.noseSize - 0.5f) * 0.15f + (umaDna.noseFlatten - 0.5f) * 0.75f, 0.25f, 3.0f))); skeleton.SetScale(UMASkeleton.StringToHash("NoseMiddleAdjust"), new Vector3( Mathf.Clamp(1 + (umaDna.noseCurve - 0.5f) * 1.5f + (umaDna.noseSize - 0.5f) * 1.0f, 0.5f, 3.0f), Mathf.Clamp(1 + (umaDna.noseCurve - 0.5f) * 0.15f + (umaDna.noseSize - 0.5f) * 0.25f + (umaDna.noseWidth - 0.5f) * 0.5f, 0.5f, 3.0f), Mathf.Clamp(1 + (umaDna.noseCurve - 0.5f) * 0.15f + (umaDna.noseSize - 0.5f) * 0.10f, 0.5f, 3.0f))); skeleton.SetRotation(UMASkeleton.StringToHash("NoseBaseAdjust"), Quaternion.Euler(new Vector3( Mathf.Clamp(0, -30, 80), Mathf.Clamp((umaDna.noseInclination - 0.5f) * 60, -60, 30), Mathf.Clamp(0, -30, 80)))); skeleton.SetPosition(UMASkeleton.StringToHash("NoseBaseAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("NoseBaseAdjust")) + new Vector3( Mathf.Clamp(0 + (umaDna.nosePronounced - 0.5f) * -0.025f, -0.025f, 0.025f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.025f, -0.025f, 0.025f))); skeleton.SetPosition(UMASkeleton.StringToHash("NoseMiddleAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("NoseBaseAdjust")) + new Vector3( Mathf.Clamp(0 + (umaDna.nosePronounced - 0.5f) * -0.012f, -0.012f, 0.012f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.015f, -0.015f, 0.015f))); //umaData.boneList["NoseBaseAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.noseSize - 0.5f) * 1.5f, 0.25f, 3.0f), //Mathf.Clamp(1 + (umaDna.noseSize - 0.5f) * 0.15f + (umaDna.noseWidth - 0.5f) * 1.0f, 0.25f, 3.0f), //Mathf.Clamp(1 + (umaDna.noseSize - 0.5f) * 0.15f + (umaDna.noseFlatten - 0.5f) * 0.75f, 0.25f, 3.0f)); //umaData.boneList["NoseMiddleAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.noseCurve - 0.5f) * 1.5f + (umaDna.noseSize - 0.5f) * 1.0f, 0.5f, 3.0f), //Mathf.Clamp(1 + (umaDna.noseCurve - 0.5f) * 0.15f + (umaDna.noseSize - 0.5f) * 0.25f + (umaDna.noseWidth - 0.5f) * 0.5f, 0.5f, 3.0f), //Mathf.Clamp(1 + (umaDna.noseCurve - 0.5f) * 0.15f + (umaDna.noseSize - 0.5f) * 0.10f, 0.5f, 3.0f)); //umaData.boneList["NoseBaseAdjust"].boneTransform.localEulerAngles = new Vector3( //Mathf.Clamp(0, -30, 80), //Mathf.Clamp((umaDna.noseInclination - 0.5f) * 60, -60, 30), //Mathf.Clamp(0, -30, 80)); //umaData.boneList["NoseBaseAdjust"].boneTransform.localPosition = umaData.boneList["NoseBaseAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0 + (umaDna.nosePronounced - 0.5f) * -0.025f, -0.025f, 0.025f), //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.025f, -0.025f, 0.025f)); //umaData.boneList["NoseMiddleAdjust"].boneTransform.localPosition = umaData.boneList["NoseBaseAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0 + (umaDna.nosePronounced - 0.5f) * -0.012f, -0.012f, 0.012f), //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.015f, -0.015f, 0.015f)); skeleton.SetPosition(UMASkeleton.StringToHash("LeftNoseAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("LeftNoseAdjust")) + new Vector3( Mathf.Clamp(0 + (umaDna.nosePronounced - 0.5f) * -0.025f, -0.025f, 0.025f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.025f, -0.025f, 0.025f))); skeleton.SetPosition(UMASkeleton.StringToHash("RightNoseAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("RightNoseAdjust")) + new Vector3( Mathf.Clamp(0 + (umaDna.nosePronounced - 0.5f) * -0.025f, -0.025f, 0.025f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.025f, -0.025f, 0.025f))); //umaData.boneList["LeftNoseAdjust"].boneTransform.localPosition = umaData.boneList["LeftNoseAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0 + (umaDna.nosePronounced - 0.5f) * -0.025f, -0.025f, 0.025f), //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.025f, -0.025f, 0.025f)); //umaData.boneList["RightNoseAdjust"].boneTransform.localPosition = umaData.boneList["RightNoseAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0 + (umaDna.nosePronounced - 0.5f) * -0.025f, -0.025f, 0.025f), //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.025f, -0.025f, 0.025f)); skeleton.SetPosition(UMASkeleton.StringToHash("UpperLipsAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("UpperLipsAdjust")) + new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.0045f, -0.0045f, 0.0045f))); //umaData.boneList["UpperLipsAdjust"].boneTransform.localPosition = umaData.boneList["UpperLipsAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.0045f, -0.0045f, 0.0045f)); skeleton.SetScale(UMASkeleton.StringToHash("MandibleAdjust"), new Vector3( Mathf.Clamp(1 + (umaDna.chinPronounced - 0.5f) * 0.18f, 0.55f, 1.75f), Mathf.Clamp(1 + (umaDna.chinSize - 0.5f) * 1.3f, 0.75f, 1.3f), Mathf.Clamp(1, 0.4f, 1.5f))); skeleton.SetPosition(UMASkeleton.StringToHash("MandibleAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("MandibleAdjust")) + new Vector3( Mathf.Clamp(0, -0.0125f, 0.0125f), Mathf.Clamp(0, -0.0125f, 0.0125f), Mathf.Clamp(0 + (umaDna.chinPosition - 0.5f) * 0.0075f, -0.0075f, 0.0075f))); //umaData.boneList["MandibleAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.chinPronounced - 0.5f) * 0.18f, 0.55f, 1.75f), //Mathf.Clamp(1 + (umaDna.chinSize - 0.5f) * 1.3f, 0.75f, 1.3f), //Mathf.Clamp(1, 0.4f, 1.5f)); //umaData.boneList["MandibleAdjust"].boneTransform.localPosition = umaData.boneList["MandibleAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0, -0.0125f, 0.0125f), //Mathf.Clamp(0, -0.0125f, 0.0125f), //Mathf.Clamp(0 + (umaDna.chinPosition - 0.5f) * 0.0075f, -0.0075f, 0.0075f)); skeleton.SetPosition(UMASkeleton.StringToHash("LeftLowMaxilarAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("LeftLowMaxilarAdjust")) + new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.jawsSize - 0.5f) * 0.025f, -0.025f, 0.025f), Mathf.Clamp(0 + (umaDna.jawsPosition - 0.5f) * 0.03f, -0.03f, 0.03f))); skeleton.SetPosition(UMASkeleton.StringToHash("RightLowMaxilarAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("RightLowMaxilarAdjust")) + new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.jawsSize - 0.5f) * -0.025f, -0.025f, 0.025f), Mathf.Clamp(0 + (umaDna.jawsPosition - 0.5f) * 0.03f, -0.03f, 0.03f))); //umaData.boneList["LeftLowMaxilarAdjust"].boneTransform.localPosition = umaData.boneList["LeftLowMaxilarAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.jawsSize - 0.5f) * 0.025f, -0.025f, 0.025f), //Mathf.Clamp(0 + (umaDna.jawsPosition - 0.5f) * 0.03f, -0.03f, 0.03f)); //umaData.boneList["RightLowMaxilarAdjust"].boneTransform.localPosition = umaData.boneList["RightLowMaxilarAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.jawsSize - 0.5f) * -0.025f, -0.025f, 0.025f), //Mathf.Clamp(0 + (umaDna.jawsPosition - 0.5f) * 0.03f, -0.03f, 0.03f)); skeleton.SetScale(UMASkeleton.StringToHash("LeftCheekAdjust"), new Vector3( Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f), Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f), Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f))); skeleton.SetScale(UMASkeleton.StringToHash("RightCheekAdjust"), new Vector3( Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f), Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f), Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f))); skeleton.SetPosition(UMASkeleton.StringToHash("LeftCheekAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("LeftCheekAdjust")) + new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.cheekPosition - 0.5f) * 0.03f, -0.03f, 0.03f))); skeleton.SetPosition(UMASkeleton.StringToHash("RightCheekAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("RightCheekAdjust")) + new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.cheekPosition - 0.5f) * 0.03f, -0.03f, 0.03f))); //umaData.boneList["LeftCheekAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f), //Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f), //Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f)); //umaData.boneList["RightCheekAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f), //Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f), //Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f)); //umaData.boneList["LeftCheekAdjust"].boneTransform.localPosition = umaData.boneList["LeftCheekAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.cheekPosition - 0.5f) * 0.03f, -0.03f, 0.03f)); //umaData.boneList["RightCheekAdjust"].boneTransform.localPosition = umaData.boneList["RightCheekAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.cheekPosition - 0.5f) * 0.03f, -0.03f, 0.03f)); skeleton.SetPosition(UMASkeleton.StringToHash("LeftLowCheekAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("LeftLowCheekAdjust")) + new Vector3( Mathf.Clamp(0 + (umaDna.lowCheekPronounced - 0.5f) * -0.07f, -0.07f, 0.07f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.lowCheekPosition - 0.5f) * 0.06f, -0.06f, 0.06f))); skeleton.SetPosition(UMASkeleton.StringToHash("RightLowCheekAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("RightLowCheekAdjust")) + new Vector3( Mathf.Clamp(0 + (umaDna.lowCheekPronounced - 0.5f) * -0.07f, -0.07f, 0.07f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.lowCheekPosition - 0.5f) * 0.06f, -0.06f, 0.06f))); //umaData.boneList["LeftLowCheekAdjust"].boneTransform.localPosition = umaData.boneList["LeftLowCheekAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0 + (umaDna.lowCheekPronounced - 0.5f) * -0.07f, -0.07f, 0.07f), //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.lowCheekPosition - 0.5f) * 0.06f, -0.06f, 0.06f)); //umaData.boneList["RightLowCheekAdjust"].boneTransform.localPosition = umaData.boneList["RightLowCheekAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0 + (umaDna.lowCheekPronounced - 0.5f) * -0.07f, -0.07f, 0.07f), //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.lowCheekPosition - 0.5f) * 0.06f, -0.06f, 0.06f)); skeleton.SetPosition(UMASkeleton.StringToHash("NoseTopAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("NoseTopAdjust")) + new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.025f + (umaDna.foreheadSize - 0.5f) * -0.0015f, -0.015f, 0.0025f))); //umaData.boneList["NoseTopAdjust"].boneTransform.localPosition = umaData.boneList["NoseTopAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.025f + (umaDna.foreheadSize - 0.5f) * -0.0015f, -0.015f, 0.0025f)); skeleton.SetPosition(UMASkeleton.StringToHash("LeftEyebrowLowAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("LeftEyebrowLowAdjust")) + new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.02f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.015f, 0.005f))); skeleton.SetPosition(UMASkeleton.StringToHash("LeftEyebrowMiddleAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("LeftEyebrowMiddleAdjust")) + new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.05f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.025f, 0.005f))); skeleton.SetPosition(UMASkeleton.StringToHash("LeftEyebrowUpAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("LeftEyebrowUpAdjust")) + new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.007f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.010f, 0.005f))); //umaData.boneList["LeftEyebrowLowAdjust"].boneTransform.localPosition = umaData.boneList["LeftEyebrowLowAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.02f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.015f, 0.005f)); //umaData.boneList["LeftEyebrowMiddleAdjust"].boneTransform.localPosition = umaData.boneList["LeftEyebrowMiddleAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.05f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.025f, 0.005f)); //umaData.boneList["LeftEyebrowUpAdjust"].boneTransform.localPosition = umaData.boneList["LeftEyebrowUpAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.007f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.010f, 0.005f)); skeleton.SetPosition(UMASkeleton.StringToHash("RightEyebrowLowAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("RightEyebrowLowAdjust")) + new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.02f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.015f, 0.005f))); skeleton.SetPosition(UMASkeleton.StringToHash("RightEyebrowMiddleAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("RightEyebrowMiddleAdjust")) + new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.05f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.025f, 0.005f))); skeleton.SetPosition(UMASkeleton.StringToHash("RightEyebrowUpAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("RightEyebrowUpAdjust")) + new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.007f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.010f, 0.005f))); //umaData.boneList["RightEyebrowLowAdjust"].boneTransform.localPosition = umaData.boneList["RightEyebrowLowAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.02f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.015f, 0.005f)); //umaData.boneList["RightEyebrowMiddleAdjust"].boneTransform.localPosition = umaData.boneList["RightEyebrowMiddleAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.05f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.025f, 0.005f)); //umaData.boneList["RightEyebrowUpAdjust"].boneTransform.localPosition = umaData.boneList["RightEyebrowUpAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.007f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.010f, 0.005f)); skeleton.SetScale(UMASkeleton.StringToHash("LipsSuperiorAdjust"), new Vector3( Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f))); skeleton.SetScale(UMASkeleton.StringToHash("LipsInferiorAdjust"), new Vector3( Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 1.0f, 0.65f, 1.5f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 1.0f, 0.65f, 1.5f))); //umaData.boneList["LipsSuperiorAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), //Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), //Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f)); //umaData.boneList["LipsInferiorAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), //Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 1.0f, 0.65f, 1.5f), //Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 1.0f, 0.65f, 1.5f)); skeleton.SetScale(UMASkeleton.StringToHash("LeftLipsSuperiorMiddleAdjust"), new Vector3( Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f))); skeleton.SetScale(UMASkeleton.StringToHash("RightLipsSuperiorMiddleAdjust"), new Vector3( Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f))); skeleton.SetScale(UMASkeleton.StringToHash("LeftLipsInferiorAdjust"), new Vector3( Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f))); skeleton.SetScale(UMASkeleton.StringToHash("RightLipsInferiorAdjust"), new Vector3( Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f))); //umaData.boneList["LeftLipsSuperiorMiddleAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), //Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), //Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f)); //umaData.boneList["RightLipsSuperiorMiddleAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), //Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), //Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f)); //umaData.boneList["LeftLipsInferiorAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), //Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), //Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f)); //umaData.boneList["RightLipsInferiorAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), //Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), //Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f)); skeleton.SetPosition(UMASkeleton.StringToHash("LipsInferiorAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("LipsInferiorAdjust")) + new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.lipsSize - 0.5f) * -0.008f, -0.1f, 0.1f))); //umaData.boneList["LipsInferiorAdjust"].boneTransform.localPosition = umaData.boneList["LipsInferiorAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.lipsSize - 0.5f) * -0.008f, -0.1f, 0.1f)); skeleton.SetPosition(UMASkeleton.StringToHash("LeftLipsAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("LeftLipsAdjust")) + new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * 0.03f, -0.02f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f))); skeleton.SetPosition(UMASkeleton.StringToHash("RightLipsAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("RightLipsAdjust")) + new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * -0.03f, -0.005f, 0.02f), Mathf.Clamp(0, -0.05f, 0.05f))); //umaData.boneList["LeftLipsAdjust"].boneTransform.localPosition = umaData.boneList["LeftLipsAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * 0.03f, -0.02f, 0.005f), //Mathf.Clamp(0, -0.05f, 0.05f)); //umaData.boneList["RightLipsAdjust"].boneTransform.localPosition = umaData.boneList["RightLipsAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * -0.03f, -0.005f, 0.02f), //Mathf.Clamp(0, -0.05f, 0.05f)); skeleton.SetPosition(UMASkeleton.StringToHash("LeftLipsSuperiorMiddleAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("LeftLipsSuperiorMiddleAdjust")) + new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * 0.007f, -0.02f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f))); skeleton.SetPosition(UMASkeleton.StringToHash("RightLipsSuperiorMiddleAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("RightLipsSuperiorMiddleAdjust")) + new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * -0.007f, -0.005f, 0.02f), Mathf.Clamp(0, -0.05f, 0.05f))); skeleton.SetPosition(UMASkeleton.StringToHash("LeftLipsInferiorAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("LeftLipsInferiorAdjust")) + new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * 0.007f, -0.02f, 0.005f), Mathf.Clamp(0 + (umaDna.lipsSize - 0.5f) * -0.008f, -0.1f, 0.1f))); skeleton.SetPosition(UMASkeleton.StringToHash("RightLipsInferiorAdjust"), skeleton.GetPosition(UMASkeleton.StringToHash("RightLipsInferiorAdjust")) + new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * -0.007f, -0.005f, 0.02f), Mathf.Clamp(0 + (umaDna.lipsSize - 0.5f) * -0.008f, -0.1f, 0.1f))); //umaData.boneList["LeftLipsSuperiorMiddleAdjust"].boneTransform.localPosition = umaData.boneList["LeftLipsSuperiorMiddleAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * 0.007f, -0.02f, 0.005f), //Mathf.Clamp(0, -0.05f, 0.05f)); //umaData.boneList["RightLipsSuperiorMiddleAdjust"].boneTransform.localPosition = umaData.boneList["RightLipsSuperiorMiddleAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * -0.007f, -0.005f, 0.02f), //Mathf.Clamp(0, -0.05f, 0.05f)); //umaData.boneList["LeftLipsInferiorAdjust"].boneTransform.localPosition = umaData.boneList["LeftLipsInferiorAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * 0.007f, -0.02f, 0.005f), //Mathf.Clamp(0 + (umaDna.lipsSize - 0.5f) * -0.008f, -0.1f, 0.1f)); //umaData.boneList["RightLipsInferiorAdjust"].boneTransform.localPosition = umaData.boneList["RightLipsInferiorAdjust"].actualBonePosition + new Vector3( //Mathf.Clamp(0, -0.05f, 0.05f), //Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * -0.007f, -0.005f, 0.02f), //Mathf.Clamp(0 + (umaDna.lipsSize - 0.5f) * -0.008f, -0.1f, 0.1f)); ////Bone structure change skeleton.SetScale(UMASkeleton.StringToHash("Global"), new Vector3( Mathf.Clamp(1 + (umaDna.height - 0.5f) * 1.0f + (umaDna.legsSize - 0.5f) * 1.0f, 0.5f, 3.0f), Mathf.Clamp(1 + (umaDna.height - 0.5f) * 1.0f + (umaDna.legsSize - 0.5f) * 1.0f, 0.5f, 3.0f), Mathf.Clamp(1 + (umaDna.height - 0.5f) * 1.0f + (umaDna.legsSize - 0.5f) * 1.0f, 0.5f, 3.0f))); //umaData.ChangeBoneScale("Global", //new Vector3( //Mathf.Clamp(1 + (umaDna.height - 0.5f) * 1.0f + (umaDna.legsSize - 0.5f) * 1.0f, 0.5f, 3.0f), //Mathf.Clamp(1 + (umaDna.height - 0.5f) * 1.0f + (umaDna.legsSize - 0.5f) * 1.0f, 0.5f, 3.0f), //Mathf.Clamp(1 + (umaDna.height - 0.5f) * 1.0f + (umaDna.legsSize - 0.5f) * 1.0f, 0.5f, 3.0f))); skeleton.SetPosition(UMASkeleton.StringToHash("Position"), skeleton.GetPosition(UMASkeleton.StringToHash("Position")) + new Vector3( Mathf.Clamp((umaDna.feetSize - 0.5f) * -0.27f, -0.15f, 0.0675f), Mathf.Clamp(0, -10, 10), Mathf.Clamp(0, -10, 10))); //umaData.ChangeBoneMoveRelative("Position", new Vector3( //Mathf.Clamp((umaDna.feetSize - 0.5f) * -0.27f, -0.15f, 0.0675f), //Mathf.Clamp(0, -10, 10), //Mathf.Clamp(0, -10, 10))); skeleton.SetScale(UMASkeleton.StringToHash("LowerBack"), new Vector3( Mathf.Clamp(1 - (umaDna.legsSize - 0.5f) * 1.0f, 0.5f, 3.0f), Mathf.Clamp(1 - (umaDna.legsSize - 0.5f) * 1.0f, 0.5f, 3.0f), Mathf.Clamp(1 - (umaDna.legsSize - 0.5f) * 1.0f, 0.5f, 3.0f))); //umaData.ChangeBoneScale("LowerBack", //new Vector3( //Mathf.Clamp(1 - (umaDna.legsSize - 0.5f) * 1.0f, 0.5f, 3.0f), //Mathf.Clamp(1 - (umaDna.legsSize - 0.5f) * 1.0f, 0.5f, 3.0f), //Mathf.Clamp(1 - (umaDna.legsSize - 0.5f) * 1.0f, 0.5f, 3.0f))); skeleton.SetScale(UMASkeleton.StringToHash("Head"), new Vector3( Mathf.Clamp(1 + (umaDna.headSize - 0.5f) * 2.0f, 0.5f, 2), Mathf.Clamp(1 + (umaDna.headSize - 0.5f) * 2.0f, 0.5f, 2), Mathf.Clamp(1 + (umaDna.headSize - 0.5f) * 2.0f, 0.5f, 2))); //umaData.ChangeBoneScale("Head", //new Vector3( //Mathf.Clamp(1 + (umaDna.headSize - 0.5f) * 2.0f, 0.5f, 2), //Mathf.Clamp(1 + (umaDna.headSize - 0.5f) * 2.0f, 0.5f, 2), //Mathf.Clamp(1 + (umaDna.headSize - 0.5f) * 2.0f, 0.5f, 2))); skeleton.SetScale(UMASkeleton.StringToHash("LeftArm"), new Vector3( Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(UMASkeleton.StringToHash("RightArm"), new Vector3( Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f))); //umaData.ChangeBoneScale("LeftArm", //new Vector3( //Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f), //Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f), //Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f))); //umaData.ChangeBoneScale("RightArm", //new Vector3( //Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f), //Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f), //Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(UMASkeleton.StringToHash("LeftForeArm"), new Vector3( Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(UMASkeleton.StringToHash("RightForeArm"), new Vector3( Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f))); //umaData.ChangeBoneScale("LeftForeArm", //new Vector3( //Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f), //Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f), //Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f))); //umaData.ChangeBoneScale("RightForeArm", //new Vector3( //Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f), //Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f), //Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(UMASkeleton.StringToHash("LeftHand"), new Vector3( Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(UMASkeleton.StringToHash("RightHand"), new Vector3( Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f))); //umaData.ChangeBoneScale("LeftHand", //new Vector3( //Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f), //Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f), //Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f))); //umaData.ChangeBoneScale("RightHand", //new Vector3( //Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f), //Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f), //Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(UMASkeleton.StringToHash("LeftFoot"), new Vector3( Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(UMASkeleton.StringToHash("RightFoot"), new Vector3( Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f))); //umaData.ChangeBoneScale("LeftFoot", //new Vector3( //Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f), //Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f), //Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f))); //umaData.ChangeBoneScale("RightFoot", //new Vector3( //Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f), //Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f), //Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetPosition(UMASkeleton.StringToHash("LeftUpLeg"), skeleton.GetPosition(UMASkeleton.StringToHash("LeftUpLeg")) + new Vector3( Mathf.Clamp(0, -10, 10), Mathf.Clamp((umaDna.legSeparation - 0.5f) * -0.15f + (umaDna.lowerWeight - 0.5f) * -0.035f + (umaDna.legsSize - 0.5f) * 0.1f, -0.025f, 0.025f), Mathf.Clamp(0, -10, 10))); skeleton.SetPosition(UMASkeleton.StringToHash("RightUpLeg"), skeleton.GetPosition(UMASkeleton.StringToHash("RightUpLeg")) + new Vector3( Mathf.Clamp(0, -10, 10), Mathf.Clamp((umaDna.legSeparation - 0.5f) * 0.15f + (umaDna.lowerWeight - 0.5f) * 0.035f + (umaDna.legsSize - 0.5f) * -0.1f, -0.025f, 0.025f), Mathf.Clamp(0, -10, 10))); //umaData.ChangeBoneMoveRelative("LeftUpLeg",new Vector3( //Mathf.Clamp(0, -10, 10), //Mathf.Clamp((umaDna.legSeparation - 0.5f) * -0.15f + (umaDna.lowerWeight - 0.5f) * -0.035f + (umaDna.legsSize - 0.5f) * 0.1f, -0.025f, 0.025f), //Mathf.Clamp(0, -10, 10))); //umaData.ChangeBoneMoveRelative("RightUpLeg",new Vector3( //Mathf.Clamp(0, -10, 10), //Mathf.Clamp((umaDna.legSeparation - 0.5f) * 0.15f + (umaDna.lowerWeight - 0.5f) * 0.035f + (umaDna.legsSize - 0.5f) * -0.1f, -0.025f, 0.025f), //Mathf.Clamp(0, -10, 10))); skeleton.SetPosition(UMASkeleton.StringToHash("LeftShoulder"), skeleton.GetPosition(UMASkeleton.StringToHash("LeftShoulder")) + new Vector3( Mathf.Clamp(0, -10, 10), Mathf.Clamp(0.003f + (umaDna.upperMuscle - 0.5f) * -0.265f, -0.085f, 0.015f), Mathf.Clamp(0, -10, 10))); skeleton.SetPosition(UMASkeleton.StringToHash("RightShoulder"), skeleton.GetPosition(UMASkeleton.StringToHash("RightShoulder")) + new Vector3( Mathf.Clamp(0, -10, 10), Mathf.Clamp(0.003f + (umaDna.upperMuscle - 0.5f) * 0.265f, -0.015f, 0.085f), Mathf.Clamp(0, -10, 10))); //umaData.ChangeBoneMoveRelative("LeftShoulder", new Vector3( //Mathf.Clamp(0, -10, 10), //Mathf.Clamp(0.003f + (umaDna.upperMuscle - 0.5f) * -0.265f, -0.085f, 0.015f), //Mathf.Clamp(0, -10, 10))); //umaData.ChangeBoneMoveRelative("RightShoulder",new Vector3( //Mathf.Clamp(0, -10, 10), //Mathf.Clamp(0.003f + (umaDna.upperMuscle - 0.5f) * 0.265f, -0.015f, 0.085f), //Mathf.Clamp(0, -10, 10))); skeleton.SetScale(UMASkeleton.StringToHash("Mandible"), new Vector3( Mathf.Clamp(1 + (umaDna.mandibleSize - 0.5f) * 0.35f, 0.35f, 1.35f), Mathf.Clamp(1 + (umaDna.mandibleSize - 0.5f) * 0.35f, 0.35f, 1.35f), Mathf.Clamp(1 + (umaDna.mandibleSize - 0.5f) * 0.35f, 0.35f, 1.35f))); //umaData.ChangeBoneScale("Mandible", //new Vector3( //Mathf.Clamp(1 + (umaDna.mandibleSize - 0.5f) * 0.35f, 0.35f, 1.35f), //Mathf.Clamp(1 + (umaDna.mandibleSize - 0.5f) * 0.35f, 0.35f, 1.35f), //Mathf.Clamp(1 + (umaDna.mandibleSize - 0.5f) * 0.35f, 0.35f, 1.35f))); }
/// <summary> /// Adjusts a skeleton to reflect the DNA values from UMA character data. /// </summary> /// <remarks> /// This will set the postion, rotation, and scale of the various adjustment /// bones used by the UMA human rigs to generate a unique character shape. /// Also calculates a somewhat realistic mass for the character and the /// height and radius of their default collider. /// </remarks> /// <param name="umaData">UMA data.</param> /// <param name="skeleton">Skeleton.</param> public static void UpdateUMAFemaleDNABones(UMAData umaData, UMASkeleton skeleton) { var umaDna = umaData.GetDna<UMADnaHumanoid>(); skeleton.SetScale(headAdjustHash, new Vector3( Mathf.Clamp(1, 1, 1), Mathf.Clamp(1 + (umaDna.headWidth - 0.5f) * 0.30f, 0.5f, 1.6f), Mathf.Clamp(1 , 1, 1))); //umaData.boneList["HeadAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 1, 1), //Mathf.Clamp(1 + (umaDna.headWidth - 0.5f) * 0.30f, 0.5f, 1.6f), //Mathf.Clamp(1 , 1, 1)); skeleton.SetScale(neckAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.neckThickness - 0.5f) * 0.80f, 0.5f, 1.6f), Mathf.Clamp(1 + (umaDna.neckThickness - 0.5f) * 1.2f, 0.5f, 1.6f))); //umaData.boneList["NeckAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.neckThickness - 0.5f) * 0.80f, 0.5f, 1.6f), //Mathf.Clamp(1 + (umaDna.neckThickness - 0.5f) * 1.2f, 0.5f, 1.6f)); skeleton.SetScale(leftOuterBreastHash, new Vector3( Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f))); skeleton.SetScale(rightOuterBreastHash, new Vector3( Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f))); //umaData.boneList["LeftOuterBreast"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), //Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), //Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f)); //umaData.boneList["RightOuterBreast"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), //Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), //Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f)); skeleton.SetScale(leftEyeHash, new Vector3( Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f), Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f), Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f))); skeleton.SetScale(rightEyeHash, new Vector3( Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f), Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f), Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f))); //umaData.boneList["LeftEye"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f), //Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f), //Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f)); //umaData.boneList["RightEye"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f), //Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f), //Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f , 0.7f, 1.4f)); skeleton.SetRotation(leftEyeAdjustHash, Quaternion.Euler(new Vector3((umaDna.eyeRotation - 0.5f) * 20, 0, 0))); skeleton.SetRotation(rightEyeAdjustHash, Quaternion.Euler(new Vector3(-(umaDna.eyeRotation - 0.5f) * 20, 0, 0))); //umaData.boneList["LeftEye"].boneTransform.localEulerAngles = new Vector3((umaDna.eyeRotation - 0.5f) * 20, -90, -180); //umaData.boneList["RightEye"].boneTransform.localEulerAngles = new Vector3(-(umaDna.eyeRotation - 0.5f) * 20, -90, -180); skeleton.SetScale(spine1AdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.10f + (umaDna.upperMuscle - 0.5f) * 0.15f, 0.75f, 1.10f), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.10f + (umaDna.upperMuscle - 0.5f) * 0.25f, 0.85f, 1.00f))); //umaData.boneList["Spine1Adjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.10f + (umaDna.upperMuscle - 0.5f) * 0.15f, 0.75f, 1.10f), //Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.10f + (umaDna.upperMuscle - 0.5f) * 0.25f, 0.85f, 1.00f)); skeleton.SetScale(spineAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.upperMuscle - 0.5f) * 0.25f, 0.85f, 1.350f), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.upperMuscle - 0.5f) * 0.25f, 0.85f, 1.450f))); //umaData.boneList["SpineAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.upperMuscle - 0.5f) * 0.25f, 0.85f, 1.350f), //Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.upperMuscle - 0.5f) * 0.25f, 0.85f, 1.450f)); skeleton.SetScale(lowerBackBellyHash, new Vector3( Mathf.Clamp(1 + (umaDna.belly - 0.5f) * 1.75f, 0.35f, 1.75f), Mathf.Clamp(1 + (umaDna.waist - 0.5f) * 1.75f, 0.35f, 1.75f), Mathf.Clamp(1 + (umaDna.belly - 0.5f) * 3.00f, 0.35f, 3.0f))); //umaData.boneList["LowerBackBelly"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.belly - 0.5f) * 1.75f, 0.35f, 1.75f), //Mathf.Clamp(1 + (umaDna.waist - 0.5f) * 1.75f, 0.35f, 1.75f), //Mathf.Clamp(1 + (umaDna.belly - 0.5f) * 3.00f, 0.35f, 3.0f)); skeleton.SetScale(lowerBackAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.lowerWeight - 0.5f) * 0.15f, 0.85f, 1.5f), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.lowerWeight - 0.5f) * 0.15f, 0.85f, 1.5f), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.lowerWeight - 0.5f) * 0.15f, 0.85f, 1.5f))); //umaData.boneList["LowerBackAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.lowerWeight - 0.5f) * 0.15f, 0.85f, 1.5f), //Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.lowerWeight - 0.5f) * 0.15f, 0.85f, 1.5f), //Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.lowerWeight - 0.5f) * 0.15f, 0.85f, 1.5f)); skeleton.SetScale(leftTrapeziusHash, new Vector3( Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f))); skeleton.SetScale(rightTrapeziusHash, new Vector3( Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f))); //umaData.boneList["LeftTrapezius"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), //Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), //Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f)); //umaData.boneList["RightTrapezius"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), //Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), //Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f)); skeleton.SetScale(leftArmAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f), Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f))); skeleton.SetScale(rightArmAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f), Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f))); //umaData.boneList["LeftArmAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f), //Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f)); //umaData.boneList["RightArmAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f), //Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f)); skeleton.SetScale(leftForeArmAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f))); skeleton.SetScale(rightForeArmAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f))); //umaData.boneList["LeftForeArmAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f), //Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f)); //umaData.boneList["RightForeArmAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f), //Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f)); skeleton.SetScale(leftForeArmTwistAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f))); skeleton.SetScale(rightForeArmTwistAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f))); //umaData.boneList["LeftForeArmTwistAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f), //Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f)); //umaData.boneList["RightForeArmTwistAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f), //Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f)); skeleton.SetScale(leftShoulderAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f))); skeleton.SetScale(rightShoulderAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f))); //umaData.boneList["LeftShoulderAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f), //Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f)); //umaData.boneList["RightShoulderAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f), //Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f)); skeleton.SetScale(leftUpLegAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.65f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.35f), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.65f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.35f))); skeleton.SetScale(rightUpLegAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.65f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.35f), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.65f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.35f))); //umaData.boneList["LeftUpLegAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.65f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.35f), //Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.65f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.35f)); //umaData.boneList["RightUpLegAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.65f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.35f), //Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.65f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.35f)); skeleton.SetScale(leftLegAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.95f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.75f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f))); skeleton.SetScale(rightLegAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.95f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.75f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f))); //umaData.boneList["LeftLegAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.95f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f), //Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.75f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f)); //umaData.boneList["RightLegAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1, 0.6f, 2), //Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.95f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f), //Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.75f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f)); skeleton.SetScale(leftGluteusHash, new Vector3( Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f), Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f), Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f))); skeleton.SetScale(rightGluteusHash, new Vector3( Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f), Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f), Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f))); //umaData.boneList["LeftGluteus"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f), //Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f), //Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f)); //umaData.boneList["RightGluteus"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f), //Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f), //Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f , 0.25f, 2.35f)); skeleton.SetScale(leftEarAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f))); skeleton.SetScale(rightEarAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f))); //umaData.boneList["LeftEarAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), //Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), //Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f)); //umaData.boneList["RightEarAdjust"].boneTransform.localScale = new Vector3( //Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), //Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), //Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f)); skeleton.SetPositionRelative(leftEarAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.headWidth - 0.5f) * -0.01f, -0.01f, 0.01f), Mathf.Clamp(0 + (umaDna.headWidth - 0.5f) * -0.03f, -0.03f, 0.03f), Mathf.Clamp(0 + (umaDna.earsPosition - 0.5f) * 0.02f, -0.02f, 0.02f))); skeleton.SetPositionRelative(rightEarAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.headWidth - 0.5f) * -0.01f, -0.01f, 0.01f), Mathf.Clamp(0 + (umaDna.headWidth - 0.5f) * 0.03f, -0.03f, 0.03f), Mathf.Clamp(0 + (umaDna.earsPosition - 0.5f) * 0.02f, -0.02f, 0.02f))); skeleton.SetRotation(leftEarAdjustHash, Quaternion.Euler(new Vector3( Mathf.Clamp(0, -30, 80), Mathf.Clamp(0, -30, 80), Mathf.Clamp((umaDna.earsRotation - 0.5f) * 40, -15, 40)))); skeleton.SetRotation(rightEarAdjustHash, Quaternion.Euler(new Vector3( Mathf.Clamp(0, -30, 80), Mathf.Clamp(0, -30, 80), Mathf.Clamp((umaDna.earsRotation - 0.5f) * -40, -40, 15)))); skeleton.SetScale(noseBaseAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.noseSize - 0.5f) * 1.5f, 0.4f, 3.0f), Mathf.Clamp(1 + (umaDna.noseSize - 0.5f) * 0.15f + (umaDna.noseWidth - 0.5f) * 1.0f, 0.25f, 3.0f), Mathf.Clamp(1 + (umaDna.noseSize - 0.5f) * 0.15f + (umaDna.noseFlatten - 0.5f) * 0.75f, 0.25f, 3.0f))); skeleton.SetScale(noseMiddleAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.noseCurve - 0.5f) * 1.9f + (umaDna.noseSize - 0.5f) * 1.0f, 0.5f, 3.0f), Mathf.Clamp(1 + (umaDna.noseCurve - 0.5f) * 0.15f + (umaDna.noseSize - 0.5f) * 0.25f + (umaDna.noseWidth - 0.5f) * 0.5f, 0.5f, 3.0f), Mathf.Clamp(1 + (umaDna.noseCurve - 0.5f) * 0.15f + (umaDna.noseSize - 0.5f) * 0.10f, 0.5f, 3.0f))); skeleton.SetRotation(noseBaseAdjustHash, Quaternion.Euler(new Vector3( Mathf.Clamp(0, -30, 80), Mathf.Clamp((umaDna.noseInclination - 0.5f) * 60, -60, 30), Mathf.Clamp(0, -30, 80)))); skeleton.SetPositionRelative(noseBaseAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.nosePronounced - 0.5f) * -0.0125f, -0.025f, 0.025f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.0125f, -0.025f, 0.025f))); skeleton.SetPositionRelative(noseMiddleAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.nosePronounced - 0.5f) * -0.006f, -0.012f, 0.012f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.007f, -0.015f, 0.015f))); skeleton.SetPositionRelative(leftNoseAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.nosePronounced - 0.5f) * -0.0125f, -0.025f, 0.025f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.0125f, -0.025f, 0.025f))); skeleton.SetPositionRelative(rightNoseAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.nosePronounced - 0.5f) * -0.0125f, -0.025f, 0.025f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.0125f, -0.025f, 0.025f))); skeleton.SetPositionRelative(upperLipsAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.0045f, -0.0045f, 0.0045f))); skeleton.SetScale(mandibleAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.chinPronounced - 0.5f) * 0.18f, 0.55f, 1.75f), Mathf.Clamp(1 + (umaDna.chinSize - 0.5f) * 1.3f, 0.75f, 1.3f), Mathf.Clamp(1, 0.4f, 1.5f))); skeleton.SetPositionRelative(mandibleAdjustHash, new Vector3( Mathf.Clamp(0, -0.0125f, 0.0125f), Mathf.Clamp(0, -0.0125f, 0.0125f), Mathf.Clamp(0 + (umaDna.chinPosition - 0.5f) * 0.0075f, -0.0075f, 0.0075f))); skeleton.SetPositionRelative(leftLowMaxilarAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.jawsSize - 0.5f) * 0.025f, -0.025f, 0.025f), Mathf.Clamp(0 + (umaDna.jawsPosition - 0.5f) * 0.03f, -0.03f, 0.03f))); skeleton.SetPositionRelative(rightLowMaxilarAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.jawsSize - 0.5f) * -0.025f, -0.025f, 0.025f), Mathf.Clamp(0 + (umaDna.jawsPosition - 0.5f) * 0.03f, -0.03f, 0.03f))); skeleton.SetScale(leftCheekAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f), Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f), Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f))); skeleton.SetScale(rightCheekAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f), Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f), Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f))); skeleton.SetPositionRelative(leftCheekAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.cheekPosition - 0.5f) * 0.03f, -0.03f, 0.03f))); skeleton.SetPositionRelative(rightCheekAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.cheekPosition - 0.5f) * 0.03f, -0.03f, 0.03f))); skeleton.SetPositionRelative(leftLowCheekAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.lowCheekPronounced - 0.5f) * -0.035f, -0.07f, 0.035f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.lowCheekPosition - 0.5f) * 0.06f, -0.06f, 0.06f))); skeleton.SetPositionRelative(rightLowCheekAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.lowCheekPronounced - 0.5f) * -0.035f, -0.07f, 0.035f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.lowCheekPosition - 0.5f) * 0.06f, -0.06f, 0.06f))); skeleton.SetPositionRelative(noseTopAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.025f + (umaDna.foreheadSize - 0.5f) * -0.0015f, -0.015f, 0.0025f))); skeleton.SetPositionRelative(leftEyebrowLowAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.02f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.015f, 0.005f))); skeleton.SetPositionRelative(leftEyebrowMiddleAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.04f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.025f, 0.005f))); skeleton.SetPositionRelative(leftEyebrowUpAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.007f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.010f, 0.005f))); skeleton.SetPositionRelative(rightEyebrowLowAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.02f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.015f, 0.005f))); skeleton.SetPositionRelative(rightEyebrowMiddleAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.04f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.025f, 0.005f))); skeleton.SetPositionRelative(rightEyebrowUpAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.007f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.010f, 0.005f))); skeleton.SetScale(lipsSuperiorAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f))); skeleton.SetScale(lipsInferiorAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 1.0f, 0.65f, 1.5f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 1.0f, 0.65f, 1.5f))); skeleton.SetScale(leftLipsSuperiorMiddleAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f))); skeleton.SetScale(rightLipsSuperiorMiddleAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f))); skeleton.SetScale(leftLipsInferiorAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f))); skeleton.SetScale(rightLipsInferiorAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f))); skeleton.SetPositionRelative(lipsInferiorAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.lipsSize - 0.5f) * -0.008f, -0.1f, 0.1f))); skeleton.SetPositionRelative(leftLipsAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * 0.03f, -0.02f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f))); skeleton.SetPositionRelative(rightLipsAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * -0.03f, -0.005f, 0.02f), Mathf.Clamp(0, -0.05f, 0.05f))); skeleton.SetPositionRelative(leftLipsSuperiorMiddleAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * 0.007f, -0.02f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f))); skeleton.SetPositionRelative(rightLipsSuperiorMiddleAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * -0.007f, -0.005f, 0.02f), Mathf.Clamp(0, -0.05f, 0.05f))); skeleton.SetPositionRelative(leftLipsInferiorAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * 0.007f, -0.02f, 0.005f), Mathf.Clamp(0 + (umaDna.lipsSize - 0.5f) * -0.008f, -0.1f, 0.1f))); skeleton.SetPositionRelative(rightLipsInferiorAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * -0.007f, -0.005f, 0.02f), Mathf.Clamp(0 + (umaDna.lipsSize - 0.5f) * -0.008f, -0.1f, 0.1f))); ////Bone structure change float overallScale = 0.81f + (umaDna.height - 0.5f) * 1.0f + (umaDna.legsSize - 0.5f) * 1.0f; overallScale = Mathf.Clamp(overallScale, 0.4f, 1.8f); skeleton.SetScale(positionHash, new Vector3(overallScale, overallScale, overallScale)); skeleton.SetPositionRelative(positionHash, new Vector3( Mathf.Clamp((umaDna.feetSize - 0.5f) * -0.27f, -0.15f, 0.0675f), Mathf.Clamp(0, -10, 10), Mathf.Clamp(0, -10, 10))); float lowerBackScale = Mathf.Clamp(1 - (umaDna.legsSize - 0.5f) * 1.0f, 0.5f, 3.0f); skeleton.SetScale(lowerBackHash, new Vector3(lowerBackScale, lowerBackScale, lowerBackScale)); skeleton.SetScale(headHash, new Vector3( Mathf.Clamp(1 + (umaDna.headSize - 0.5f) * 2.0f, 0.5f, 2), Mathf.Clamp(1 + (umaDna.headSize - 0.5f) * 2.0f, 0.5f, 2), Mathf.Clamp(1 + (umaDna.headSize - 0.5f) * 2.0f, 0.5f, 2))); skeleton.SetScale(leftArmHash, new Vector3( Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(rightArmHash, new Vector3( Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(leftForeArmHash, new Vector3( Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(rightForeArmHash, new Vector3( Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(leftHandHash, new Vector3( Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(rightHandHash, new Vector3( Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(leftFootHash, new Vector3( Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(rightFootHash, new Vector3( Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetPositionRelative(leftUpLegHash, new Vector3( Mathf.Clamp(0, -10, 10), Mathf.Clamp((umaDna.legSeparation - 0.5f) * -0.15f + (umaDna.lowerWeight - 0.5f) * -0.035f + (umaDna.legsSize - 0.5f) * 0.1f, -0.055f, 0.055f), Mathf.Clamp(0, -10, 10))); skeleton.SetPositionRelative(rightUpLegHash, new Vector3( Mathf.Clamp(0, -10, 10), Mathf.Clamp((umaDna.legSeparation - 0.5f) * 0.15f + (umaDna.lowerWeight - 0.5f) * 0.035f + (umaDna.legsSize - 0.5f) * -0.1f, -0.025f, 0.025f), Mathf.Clamp(0, -10, 10))); skeleton.SetPositionRelative(leftShoulderHash, new Vector3( Mathf.Clamp(0, -10, 10), Mathf.Clamp((umaDna.upperMuscle - 0.5f) * -0.0235f, -0.025f, 0.015f), Mathf.Clamp(0, -10, 10))); skeleton.SetPositionRelative(rightShoulderHash, new Vector3( Mathf.Clamp(0, -10, 10), Mathf.Clamp((umaDna.upperMuscle - 0.5f) * 0.0235f, -0.015f, 0.025f), Mathf.Clamp(0, -10, 10))); skeleton.SetScale(mandibleHash, new Vector3( Mathf.Clamp(1 + (umaDna.mandibleSize - 0.5f) * 0.35f, 0.35f, 1.35f), Mathf.Clamp(1 + (umaDna.mandibleSize - 0.5f) * 0.35f, 0.35f, 1.35f), Mathf.Clamp(1 + (umaDna.mandibleSize - 0.5f) * 0.35f, 0.35f, 1.35f))); umaData.characterHeight = overallScale * (0.85f + 1.2f * lowerBackScale); umaData.characterRadius = 0.26f * overallScale; umaData.characterMass = 42f * overallScale + 28f * umaDna.upperWeight + 22f * umaDna.lowerWeight; }
/// <summary> /// Apply the modifiers using the given dna (determined by the typehash) /// </summary> /// <param name="umaData"></param> /// <param name="skeleton"></param> /// <param name="dnaTypeHash"></param> public override void ApplyDNA(UMAData umaData, UMASkeleton skeleton, int dnaTypeHash) { var umaDna = umaData.GetDna(dnaTypeHash); var masterWeightCalc = masterWeight.GetWeight(umaDna); if (masterWeightCalc == 0f) { return; } for (int i = 0; i < _skeletonModifiers.Count; i++) { _skeletonModifiers[i].umaDNA = umaDna; var thisHash = (_skeletonModifiers[i].hash != 0) ? _skeletonModifiers[i].hash : UMAUtils.StringToHash(_skeletonModifiers[i].hashName); //check skeleton has the bone we want to change if (!skeleton.HasBone(thisHash)) { //Debug.LogWarning("You were trying to apply skeleton modifications to a bone that didn't exist (" + _skeletonModifiers[i].hashName + ") on " + umaData.gameObject.name); continue; } //With these ValueX.x is the calculated value and ValueX.y is min and ValueX.z is max var thisValueX = _skeletonModifiers[i].CalculateValueX(umaDna); var thisValueY = _skeletonModifiers[i].CalculateValueY(umaDna); var thisValueZ = _skeletonModifiers[i].CalculateValueZ(umaDna); if (_skeletonModifiers[i].property == SkeletonModifier.SkeletonPropType.Position) { skeleton.SetPositionRelative(thisHash, new Vector3( Mathf.Clamp(thisValueX.x, thisValueX.y, thisValueX.z), Mathf.Clamp(thisValueY.x, thisValueY.y, thisValueY.z), Mathf.Clamp(thisValueZ.x, thisValueZ.y, thisValueZ.z)), masterWeightCalc); } else if (_skeletonModifiers[i].property == SkeletonModifier.SkeletonPropType.Rotation) { skeleton.SetRotationRelative(thisHash, Quaternion.Euler(new Vector3( Mathf.Clamp(thisValueX.x, thisValueX.y, thisValueX.z), Mathf.Clamp(thisValueY.x, thisValueY.y, thisValueY.z), Mathf.Clamp(thisValueZ.x, thisValueZ.y, thisValueZ.z))), masterWeightCalc); } else if (_skeletonModifiers[i].property == SkeletonModifier.SkeletonPropType.Scale) { //If there are two sets of skeletonModifiers and both are at 50% it needs to apply them both but the result should be cumulative //so we need to work out the difference this one is making, weight that and add it to the current scale of the bone var scale = new Vector3( Mathf.Clamp(thisValueX.x, thisValueX.y, thisValueX.z), Mathf.Clamp(thisValueY.x, thisValueY.y, thisValueY.z), Mathf.Clamp(thisValueZ.x, thisValueZ.y, thisValueZ.z)); //we cant use val.value here because the initial values always need to be applied var defaultVal = SkeletonModifier.skelAddDefaults[SkeletonModifier.SkeletonPropType.Scale].x; var scaleDiff = new Vector3(scale.x - defaultVal, scale.y - defaultVal, scale.z - defaultVal); var weightedScaleDiff = scaleDiff * masterWeightCalc; var fullScale = skeleton.GetScale(_skeletonModifiers[i].hash) + weightedScaleDiff; skeleton.SetScale(thisHash, fullScale); } } }
public void UpdateDynamicUMADnaBones(UMAData umaData, UMASkeleton skeleton, bool asReset = false) { UMADnaBase umaDna; //need to use the typehash umaDna = umaData.GetDna(DNATypeHash); if (umaDna == null || asReset == true) { umaDna = null; } //Make the DNAAssets match if they dont already... if (umaDna != null) { if (((DynamicUMADnaBase)umaDna).dnaAsset != dnaAsset) { ((DynamicUMADnaBase)umaDna).dnaAsset = dnaAsset; } } float overallScaleCalc = 0; //float lowerBackScale = 0; //bool overallScaleFound = false; //bool lowerBackScaleFound = false; for (int i = 0; i < skeletonModifiers.Count; i++) { skeletonModifiers[i].umaDNA = umaDna; var thisHash = (skeletonModifiers[i].hash != 0) ? skeletonModifiers[i].hash : GetHash(skeletonModifiers[i].hashName); //With these ValueX.x is the calculated value and ValueX.y is min and ValueX.z is max var thisValueX = skeletonModifiers[i].ValueX; var thisValueY = skeletonModifiers[i].ValueY; var thisValueZ = skeletonModifiers[i].ValueZ; if (skeletonModifiers[i].hashName == "Position" && skeletonModifiers[i].property == SkeletonModifier.SkeletonPropType.Scale) { //TODO eli added something for overall scale to RaceData- whats that supposed to do? var calcVal = thisValueX.x - skeletonModifiers[i].valuesX.val.value + overallScale; overallScaleCalc = Mathf.Clamp(calcVal, thisValueX.y, thisValueX.z); skeleton.SetScale(skeletonModifiers[i].hash, new Vector3(overallScaleCalc, overallScaleCalc, overallScaleCalc)); //overallScaleFound = true; //Debug.Log("overallScaleCalc was " + overallScaleCalc); } /*else if (skeletonModifiers[i].hashName == "LowerBack" && skeletonModifiers[i].property == SkeletonModifier.SkeletonPropType.Scale) * { * lowerBackScale = Mathf.Clamp(thisValueX.x, thisValueX.y, thisValueX.z); * skeleton.SetScale(skeletonModifiers[i].hash, new Vector3(lowerBackScale, lowerBackScale, lowerBackScale)); * lowerBackScaleFound = true; * }*/ else if (skeletonModifiers[i].property == SkeletonModifier.SkeletonPropType.Position) { skeleton.SetPositionRelative(thisHash, new Vector3( Mathf.Clamp(thisValueX.x, thisValueX.y, thisValueX.z), Mathf.Clamp(thisValueY.x, thisValueY.y, thisValueY.z), Mathf.Clamp(thisValueZ.x, thisValueZ.y, thisValueZ.z))); } else if (skeletonModifiers[i].property == SkeletonModifier.SkeletonPropType.Rotation) { skeleton.SetRotationRelative(thisHash, Quaternion.Euler(new Vector3( Mathf.Clamp(thisValueX.x, thisValueX.y, thisValueX.z), Mathf.Clamp(thisValueY.x, thisValueY.y, thisValueY.z), Mathf.Clamp(thisValueZ.x, thisValueZ.y, thisValueZ.z))), 1f); } else if (skeletonModifiers[i].property == SkeletonModifier.SkeletonPropType.Scale) { skeleton.SetScale(thisHash, new Vector3( Mathf.Clamp(thisValueX.x, thisValueX.y, thisValueX.z), Mathf.Clamp(thisValueY.x, thisValueY.y, thisValueY.z), Mathf.Clamp(thisValueZ.x, thisValueZ.y, thisValueZ.z))); } } if (startingPose != null && asReset == false) { for (int i = 0; i < startingPose.poses.Length; i++) { skeleton.Morph(startingPose.poses[i].hash, startingPose.poses[i].position, startingPose.poses[i].scale, startingPose.poses[i].rotation, startingPoseWeight); } } //overall modifiers //Try to use updated Bounds to set the height. if (overallModifiersEnabled && umaData.myRenderer != null) { if (umaData.myRenderer.localBounds.size.y == 0) { return; } var currentSMROffscreenSetting = umaData.myRenderer.updateWhenOffscreen; Bounds newBounds; //for this to properly calculate if the character is in a scaled game object it needs to be moved into the root var umaTransform = umaData.transform; var oldParent = umaTransform.parent; var originalRot = umaTransform.localRotation; var originalPos = umaTransform.localPosition; //we also need to disable any collider that is on it so it doesn't hit anything when its moved var thisCollider = umaData.gameObject.GetComponent <Collider>(); bool thisColliderEnabled = false; if (thisCollider) { thisColliderEnabled = thisCollider.enabled; thisCollider.enabled = false; } //Now move into the root umaTransform.SetParent(null, false); umaTransform.localRotation = Quaternion.identity; umaTransform.localPosition = Vector3.zero; //Do the calculations umaData.myRenderer.updateWhenOffscreen = true; newBounds = new Bounds(umaData.myRenderer.localBounds.center, umaData.myRenderer.localBounds.size); umaData.myRenderer.updateWhenOffscreen = currentSMROffscreenSetting; //move it back umaTransform.SetParent(oldParent, false); umaTransform.localRotation = originalRot; umaTransform.localPosition = originalPos; //set any collider to its original setting if (thisCollider) { thisCollider.enabled = thisColliderEnabled; } //somehow the bounds end up beneath the floor i.e. newBounds.center.y - newBounds.extents.y is actually a minus number //tighten bounds fixes this if (tightenBounds) { Vector3 newCenter = new Vector3(newBounds.center.x, newBounds.center.y, newBounds.center.z); Vector3 newSize = new Vector3(newBounds.size.x, newBounds.size.y, newBounds.size.z); if (newBounds.center.y - newBounds.extents.y < 0) { var underAmount = newBounds.center.y - newBounds.extents.y; newSize.y = (newBounds.center.y * 2) - underAmount; newCenter.y = newSize.y / 2; } Bounds modifiedBounds = new Bounds(newCenter, newSize); newBounds = modifiedBounds; } //character height can be based on the resulting height umaData.characterHeight = newBounds.size.y * (1 + radiusAdjust.y); //radius could be based on the resulting width umaData.characterRadius = (newBounds.size.x * (radiusAdjust.x /*/2*/) + newBounds.size.z * (radiusAdjust.x /*/ 2*/)) / 2; //then base the mass on a compond of those two modified by the mass modifiers values var radiusAsDNA = (umaData.characterRadius * 2) * overallScaleCalc; var radiusYAsDNA = ((1 + radiusAdjust.y) * 0.5f) * overallScaleCalc; umaData.characterMass = (massModifiers.x * overallScaleCalc) + massModifiers.y * radiusYAsDNA + massModifiers.z * radiusAsDNA; //add bounds padding if any was set if (boundsAdjust != Vector3.zero) { newBounds.Expand(boundsAdjust); } //set the padded bounds umaData.myRenderer.localBounds = newBounds; } }
/// <summary> /// Adjusts a skeleton to reflect the DNA values from UMA character data. /// </summary> /// <remarks> /// This will set the postion, rotation, and scale of the various adjustment /// bones used by the UMA human rigs to generate a unique character shape. /// Also calculates a somewhat realistic mass for the character and the /// height and radius of their default collider. /// </remarks> /// <param name="umaData">UMA data.</param> /// <param name="skeleton">Skeleton.</param> public static void UpdateUMAFemaleDNABones(UMAData umaData, UMASkeleton skeleton) { var umaDna = umaData.GetDna <UMADnaHumanoid>(); skeleton.SetScale(headAdjustHash, new Vector3( Mathf.Clamp(1, 1, 1), Mathf.Clamp(1 + (umaDna.headWidth - 0.5f) * 0.30f, 0.5f, 1.6f), Mathf.Clamp(1, 1, 1))); skeleton.SetScale(neckAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.neckThickness - 0.5f) * 0.80f, 0.5f, 1.6f), Mathf.Clamp(1 + (umaDna.neckThickness - 0.5f) * 1.2f, 0.5f, 1.6f))); skeleton.SetScale(leftOuterBreastHash, new Vector3( Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f))); skeleton.SetScale(rightOuterBreastHash, new Vector3( Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f), Mathf.Clamp(1 + (umaDna.breastSize - 0.5f) * 1.50f + (umaDna.upperWeight - 0.5f) * 0.10f, 0.6f, 1.5f))); skeleton.SetScale(leftEyeHash, new Vector3( Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f, 0.7f, 1.4f), Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f, 0.7f, 1.4f), Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f, 0.7f, 1.4f))); skeleton.SetScale(rightEyeHash, new Vector3( Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f, 0.7f, 1.4f), Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f, 0.7f, 1.4f), Mathf.Clamp(1 + (umaDna.eyeSize - 0.5f) * 0.3f, 0.7f, 1.4f))); skeleton.SetRotation(leftEyeAdjustHash, Quaternion.Euler(new Vector3((umaDna.eyeRotation - 0.5f) * 20, 0, 0))); skeleton.SetRotation(rightEyeAdjustHash, Quaternion.Euler(new Vector3(-(umaDna.eyeRotation - 0.5f) * 20, 0, 0))); skeleton.SetScale(spine1AdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.10f + (umaDna.upperMuscle - 0.5f) * 0.15f, 0.75f, 1.10f), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.10f + (umaDna.upperMuscle - 0.5f) * 0.25f, 0.85f, 1.00f))); skeleton.SetScale(spineAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.upperMuscle - 0.5f) * 0.25f, 0.85f, 1.350f), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.upperMuscle - 0.5f) * 0.25f, 0.85f, 1.450f))); skeleton.SetScale(lowerBackBellyHash, new Vector3( Mathf.Clamp(1 + (umaDna.belly - 0.5f) * 1.75f, 0.35f, 1.75f), Mathf.Clamp(1 + (umaDna.waist - 0.5f) * 1.75f, 0.35f, 1.75f), Mathf.Clamp(1 + (umaDna.belly - 0.5f) * 3.00f, 0.35f, 3.0f))); skeleton.SetScale(lowerBackAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.lowerWeight - 0.5f) * 0.15f, 0.85f, 1.5f), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.lowerWeight - 0.5f) * 0.15f, 0.85f, 1.5f), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.25f + (umaDna.lowerWeight - 0.5f) * 0.15f, 0.85f, 1.5f))); skeleton.SetScale(leftTrapeziusHash, new Vector3( Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f))); skeleton.SetScale(rightTrapeziusHash, new Vector3( Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f), Mathf.Clamp(1 + (umaDna.upperMuscle - 0.5f) * 1.35f, 0.65f, 1.35f))); skeleton.SetScale(leftArmAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f), Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f))); skeleton.SetScale(rightArmAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f), Mathf.Clamp(1 + (umaDna.armWidth - 0.5f) * 0.65f, 0.65f, 1.65f))); skeleton.SetScale(leftForeArmAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f))); skeleton.SetScale(rightForeArmAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.65f, 0.75f, 1.25f))); skeleton.SetScale(leftForeArmTwistAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f))); skeleton.SetScale(rightForeArmTwistAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f), Mathf.Clamp(1 + (umaDna.forearmWidth - 0.5f) * 0.35f, 0.75f, 1.25f))); skeleton.SetScale(leftShoulderAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f))); skeleton.SetScale(rightShoulderAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f), Mathf.Clamp(1 + (umaDna.upperWeight - 0.5f) * 0.35f + (umaDna.upperMuscle - 0.5f) * 0.55f, 0.75f, 1.25f))); skeleton.SetScale(leftUpLegAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.65f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.35f), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.65f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.35f))); skeleton.SetScale(rightUpLegAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.65f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.35f), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.65f + (umaDna.lowerMuscle - 0.5f) * 0.15f - (umaDna.legsSize - 0.5f), 0.45f, 1.35f))); skeleton.SetScale(leftLegAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.95f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.75f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f))); skeleton.SetScale(rightLegAdjustHash, new Vector3( Mathf.Clamp(1, 0.6f, 2), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.95f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f), Mathf.Clamp(1 + (umaDna.lowerWeight - 0.5f) * 0.15f + (umaDna.lowerMuscle - 0.5f) * 0.75f - (umaDna.legsSize - 0.5f), 0.65f, 1.45f))); skeleton.SetScale(leftGluteusHash, new Vector3( Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f, 0.25f, 2.35f), Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f, 0.25f, 2.35f), Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f, 0.25f, 2.35f))); skeleton.SetScale(rightGluteusHash, new Vector3( Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f, 0.25f, 2.35f), Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f, 0.25f, 2.35f), Mathf.Clamp(1 + (umaDna.gluteusSize - 0.5f) * 1.35f, 0.25f, 2.35f))); skeleton.SetScale(leftEarAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f))); skeleton.SetScale(rightEarAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f), Mathf.Clamp(1 + (umaDna.earsSize - 0.5f) * 1.0f, 0.75f, 1.5f))); skeleton.SetPositionRelative(leftEarAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.headWidth - 0.5f) * -0.01f, -0.01f, 0.01f), Mathf.Clamp(0 + (umaDna.headWidth - 0.5f) * -0.03f, -0.03f, 0.03f), Mathf.Clamp(0 + (umaDna.earsPosition - 0.5f) * 0.02f, -0.02f, 0.02f))); skeleton.SetPositionRelative(rightEarAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.headWidth - 0.5f) * -0.01f, -0.01f, 0.01f), Mathf.Clamp(0 + (umaDna.headWidth - 0.5f) * 0.03f, -0.03f, 0.03f), Mathf.Clamp(0 + (umaDna.earsPosition - 0.5f) * 0.02f, -0.02f, 0.02f))); skeleton.SetRotation(leftEarAdjustHash, Quaternion.Euler(new Vector3( Mathf.Clamp(0, -30, 80), Mathf.Clamp(0, -30, 80), Mathf.Clamp((umaDna.earsRotation - 0.5f) * 40, -15, 40)))); skeleton.SetRotation(rightEarAdjustHash, Quaternion.Euler(new Vector3( Mathf.Clamp(0, -30, 80), Mathf.Clamp(0, -30, 80), Mathf.Clamp((umaDna.earsRotation - 0.5f) * -40, -40, 15)))); skeleton.SetScale(noseBaseAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.noseSize - 0.5f) * 1.5f, 0.4f, 3.0f), Mathf.Clamp(1 + (umaDna.noseSize - 0.5f) * 0.15f + (umaDna.noseWidth - 0.5f) * 1.0f, 0.25f, 3.0f), Mathf.Clamp(1 + (umaDna.noseSize - 0.5f) * 0.15f + (umaDna.noseFlatten - 0.5f) * 0.75f, 0.25f, 3.0f))); skeleton.SetScale(noseMiddleAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.noseCurve - 0.5f) * 1.9f + (umaDna.noseSize - 0.5f) * 1.0f, 0.5f, 3.0f), Mathf.Clamp(1 + (umaDna.noseCurve - 0.5f) * 0.15f + (umaDna.noseSize - 0.5f) * 0.25f + (umaDna.noseWidth - 0.5f) * 0.5f, 0.5f, 3.0f), Mathf.Clamp(1 + (umaDna.noseCurve - 0.5f) * 0.15f + (umaDna.noseSize - 0.5f) * 0.10f, 0.5f, 3.0f))); skeleton.SetRotation(noseBaseAdjustHash, Quaternion.Euler(new Vector3( Mathf.Clamp(0, -30, 80), Mathf.Clamp((umaDna.noseInclination - 0.5f) * 60, -60, 30), Mathf.Clamp(0, -30, 80)))); skeleton.SetPositionRelative(noseBaseAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.nosePronounced - 0.5f) * -0.0125f, -0.025f, 0.025f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.0125f, -0.025f, 0.025f))); skeleton.SetPositionRelative(noseMiddleAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.nosePronounced - 0.5f) * -0.006f, -0.012f, 0.012f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.007f, -0.015f, 0.015f))); skeleton.SetPositionRelative(leftNoseAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.nosePronounced - 0.5f) * -0.0125f, -0.025f, 0.025f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.0125f, -0.025f, 0.025f))); skeleton.SetPositionRelative(rightNoseAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.nosePronounced - 0.5f) * -0.0125f, -0.025f, 0.025f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.0125f, -0.025f, 0.025f))); skeleton.SetPositionRelative(upperLipsAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.nosePosition - 0.5f) * 0.0045f, -0.0045f, 0.0045f))); skeleton.SetScale(mandibleAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.chinPronounced - 0.5f) * 0.18f, 0.55f, 1.75f), Mathf.Clamp(1 + (umaDna.chinSize - 0.5f) * 1.3f, 0.75f, 1.3f), Mathf.Clamp(1, 0.4f, 1.5f))); skeleton.SetPositionRelative(mandibleAdjustHash, new Vector3( Mathf.Clamp(0, -0.0125f, 0.0125f), Mathf.Clamp(0, -0.0125f, 0.0125f), Mathf.Clamp(0 + (umaDna.chinPosition - 0.5f) * 0.0075f, -0.0075f, 0.0075f))); skeleton.SetPositionRelative(leftLowMaxilarAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.jawsSize - 0.5f) * 0.025f, -0.025f, 0.025f), Mathf.Clamp(0 + (umaDna.jawsPosition - 0.5f) * 0.03f, -0.03f, 0.03f))); skeleton.SetPositionRelative(rightLowMaxilarAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.jawsSize - 0.5f) * -0.025f, -0.025f, 0.025f), Mathf.Clamp(0 + (umaDna.jawsPosition - 0.5f) * 0.03f, -0.03f, 0.03f))); skeleton.SetScale(leftCheekAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f), Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f), Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f))); skeleton.SetScale(rightCheekAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f), Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f), Mathf.Clamp(1 + (umaDna.cheekSize - 0.5f) * 1.05f, 0.35f, 2.05f))); skeleton.SetPositionRelative(leftCheekAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.cheekPosition - 0.5f) * 0.03f, -0.03f, 0.03f))); skeleton.SetPositionRelative(rightCheekAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.cheekPosition - 0.5f) * 0.03f, -0.03f, 0.03f))); skeleton.SetPositionRelative(leftLowCheekAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.lowCheekPronounced - 0.5f) * -0.035f, -0.07f, 0.035f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.lowCheekPosition - 0.5f) * 0.06f, -0.06f, 0.06f))); skeleton.SetPositionRelative(rightLowCheekAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.lowCheekPronounced - 0.5f) * -0.035f, -0.07f, 0.035f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.lowCheekPosition - 0.5f) * 0.06f, -0.06f, 0.06f))); skeleton.SetPositionRelative(noseTopAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.025f + (umaDna.foreheadSize - 0.5f) * -0.0015f, -0.015f, 0.0025f))); skeleton.SetPositionRelative(leftEyebrowLowAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.02f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.015f, 0.005f))); skeleton.SetPositionRelative(leftEyebrowMiddleAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.04f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.025f, 0.005f))); skeleton.SetPositionRelative(leftEyebrowUpAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.007f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.010f, 0.005f))); skeleton.SetPositionRelative(rightEyebrowLowAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.02f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.015f, 0.005f))); skeleton.SetPositionRelative(rightEyebrowMiddleAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.04f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.025f, 0.005f))); skeleton.SetPositionRelative(rightEyebrowUpAdjustHash, new Vector3( Mathf.Clamp(0 + (umaDna.foreheadSize - 0.5f) * -0.015f, -0.025f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.foreheadPosition - 0.5f) * -0.007f + (umaDna.foreheadSize - 0.5f) * -0.005f, -0.010f, 0.005f))); skeleton.SetScale(lipsSuperiorAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f))); skeleton.SetScale(lipsInferiorAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 1.0f, 0.65f, 1.5f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 1.0f, 0.65f, 1.5f))); skeleton.SetScale(leftLipsSuperiorMiddleAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f))); skeleton.SetScale(rightLipsSuperiorMiddleAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f))); skeleton.SetScale(leftLipsInferiorAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f))); skeleton.SetScale(rightLipsInferiorAdjustHash, new Vector3( Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.05f, 1.0f, 1.05f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f), Mathf.Clamp(1 + (umaDna.lipsSize - 0.5f) * 0.9f, 0.65f, 1.5f))); skeleton.SetPositionRelative(lipsInferiorAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.lipsSize - 0.5f) * -0.008f, -0.1f, 0.1f))); skeleton.SetPositionRelative(leftLipsAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * 0.03f, -0.02f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f))); skeleton.SetPositionRelative(rightLipsAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * -0.03f, -0.005f, 0.02f), Mathf.Clamp(0, -0.05f, 0.05f))); skeleton.SetPositionRelative(leftLipsSuperiorMiddleAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * 0.007f, -0.02f, 0.005f), Mathf.Clamp(0, -0.05f, 0.05f))); skeleton.SetPositionRelative(rightLipsSuperiorMiddleAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * -0.007f, -0.005f, 0.02f), Mathf.Clamp(0, -0.05f, 0.05f))); skeleton.SetPositionRelative(leftLipsInferiorAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * 0.007f, -0.02f, 0.005f), Mathf.Clamp(0 + (umaDna.lipsSize - 0.5f) * -0.008f, -0.1f, 0.1f))); skeleton.SetPositionRelative(rightLipsInferiorAdjustHash, new Vector3( Mathf.Clamp(0, -0.05f, 0.05f), Mathf.Clamp(0 + (umaDna.mouthSize - 0.5f) * -0.007f, -0.005f, 0.02f), Mathf.Clamp(0 + (umaDna.lipsSize - 0.5f) * -0.008f, -0.1f, 0.1f))); ////Bone structure change float overallScale = 0.81f + (umaDna.height - 0.5f) * 1.0f + (umaDna.legsSize - 0.5f) * 1.0f; overallScale = Mathf.Clamp(overallScale, 0.4f, 1.8f); skeleton.SetScale(positionHash, new Vector3(overallScale, overallScale, overallScale)); skeleton.SetPositionRelative(positionHash, new Vector3( Mathf.Clamp((umaDna.feetSize - 0.5f) * -0.17f, -0.15f, 0.0675f), Mathf.Clamp(0, -10, 10), Mathf.Clamp(0, -10, 10))); float lowerBackScale = Mathf.Clamp(1 - (umaDna.legsSize - 0.5f) * 1.0f, 0.5f, 3.0f); skeleton.SetScale(lowerBackHash, new Vector3(lowerBackScale, lowerBackScale, lowerBackScale)); skeleton.SetScale(headHash, new Vector3( Mathf.Clamp(1 + (umaDna.headSize - 0.5f) * 2.0f, 0.5f, 2), Mathf.Clamp(1 + (umaDna.headSize - 0.5f) * 2.0f, 0.5f, 2), Mathf.Clamp(1 + (umaDna.headSize - 0.5f) * 2.0f, 0.5f, 2))); skeleton.SetScale(leftArmHash, new Vector3( Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(rightArmHash, new Vector3( Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.armLength - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(leftForeArmHash, new Vector3( Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(rightForeArmHash, new Vector3( Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.forearmLength - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(leftHandHash, new Vector3( Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(rightHandHash, new Vector3( Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.handsSize - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(leftFootHash, new Vector3( Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetScale(rightFootHash, new Vector3( Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f), Mathf.Clamp(1 + (umaDna.feetSize - 0.5f) * 2.0f, 0.5f, 2.0f))); skeleton.SetPositionRelative(leftUpLegHash, new Vector3( Mathf.Clamp(0, -10, 10), Mathf.Clamp((umaDna.legSeparation - 0.5f) * -0.15f + (umaDna.lowerWeight - 0.5f) * -0.035f + (umaDna.legsSize - 0.5f) * 0.1f, -0.055f, 0.055f), Mathf.Clamp(0, -10, 10))); skeleton.SetPositionRelative(rightUpLegHash, new Vector3( Mathf.Clamp(0, -10, 10), Mathf.Clamp((umaDna.legSeparation - 0.5f) * 0.15f + (umaDna.lowerWeight - 0.5f) * 0.035f + (umaDna.legsSize - 0.5f) * -0.1f, -0.055f, 0.055f), Mathf.Clamp(0, -10, 10))); skeleton.SetPositionRelative(leftShoulderHash, new Vector3( Mathf.Clamp(0, -10, 10), Mathf.Clamp((umaDna.upperMuscle - 0.5f) * -0.0235f, -0.025f, 0.015f), Mathf.Clamp(0, -10, 10))); skeleton.SetPositionRelative(rightShoulderHash, new Vector3( Mathf.Clamp(0, -10, 10), Mathf.Clamp((umaDna.upperMuscle - 0.5f) * 0.0235f, -0.015f, 0.025f), Mathf.Clamp(0, -10, 10))); skeleton.SetScale(mandibleHash, new Vector3( Mathf.Clamp(1 + (umaDna.mandibleSize - 0.5f) * 0.35f, 0.35f, 1.35f), Mathf.Clamp(1 + (umaDna.mandibleSize - 0.5f) * 0.35f, 0.35f, 1.35f), Mathf.Clamp(1 + (umaDna.mandibleSize - 0.5f) * 0.35f, 0.35f, 1.35f))); float raceHeight = umaData.umaRecipe.raceData.raceHeight; float raceRadius = umaData.umaRecipe.raceData.raceRadius; float raceMass = umaData.umaRecipe.raceData.raceMass; umaData.characterHeight = raceHeight * overallScale * (0.425f + 0.6f * lowerBackScale) + ((umaDna.feetSize - 0.5f) * 0.20f); umaData.characterRadius = raceRadius + ((umaDna.height - 0.5f) * 0.32f) + ((umaDna.upperMuscle - 0.5f) * 0.01f); umaData.characterMass = raceMass * overallScale + 28f * umaDna.upperWeight + 22f * umaDna.lowerWeight; }