缩放乌马字符团结3d

我的房间比我的UMA角色大,所以我的角色看起来很小。 我发现这个链接: http : //answers.unity3d.com/questions/988134/uma-how-to-increase-npc-avatar-scale.html

但是到处都是我的代码,它不会改变我的头像function。 这是我的代码:

using UnityEngine; using System.Collections; using UMA; public class UMACreator1 : MonoBehaviour { public UMAGeneratorBase generator; public SlotLibrary slotLibrary; public OverlayLibrary overlayLibrary; public RaceLibrary raceLibrary; public RuntimeAnimatorController animator; [Range(0.0f, 1.0f)] public float bodyMass = 0.5f; private UMADynamicAvatar umaDynamicAvatar; private UMAData umaData; private UMADnaHumanoid umaDnaHuman; private UMADnaTutorial umaDnaTutor; private int numberOfSlots = 20; void GenerateUMA() { GameObject go = new GameObject("MyUMA"); umaDynamicAvatar = go.AddComponent<UMADynamicAvatar>(); umaDynamicAvatar.Initialize(); umaData = umaDynamicAvatar.umaData; umaDynamicAvatar.umaGenerator = generator; umaData.umaGenerator = generator; umaData.umaRecipe.slotDataList = new SlotData[numberOfSlots]; umaDnaHuman = new UMADnaHumanoid(); umaDnaTutor = new UMADnaTutorial(); umaData.umaRecipe.AddDna(umaDnaHuman); umaData.umaRecipe.AddDna(umaDnaTutor); CreateMale(); umaDynamicAvatar.animationController = animator; umaDynamicAvatar.UpdateNewRace(); go.transform.parent = this.gameObject.transform; go.transform.localPosition = Vector3.zero; go.transform.localRotation = Quaternion.identity; } void CreateMale() { var umaRecipe = umaDynamicAvatar.umaData.umaRecipe; umaRecipe.SetRace(raceLibrary.GetRace("HumanMale")); umaData.umaRecipe.slotDataList[0] = slotLibrary.InstantiateSlot("MaleFace"); umaData.umaRecipe.slotDataList[0].AddOverlay(overlayLibrary.InstantiateOverlay("MaleHead02")); umaData.umaRecipe.slotDataList[1] = slotLibrary.InstantiateSlot("MaleEyes"); umaData.umaRecipe.slotDataList[1].AddOverlay(overlayLibrary.InstantiateOverlay("EyeOverlay")); umaData.umaRecipe.slotDataList[2] = slotLibrary.InstantiateSlot("MaleInnerMouth"); umaData.umaRecipe.slotDataList[2].AddOverlay(overlayLibrary.InstantiateOverlay("InnerMouth")); umaData.umaRecipe.slotDataList[3] = slotLibrary.InstantiateSlot("MaleTorso"); umaData.umaRecipe.slotDataList[3].AddOverlay(overlayLibrary.InstantiateOverlay("MaleBody02")); umaData.umaRecipe.slotDataList[4] = slotLibrary.InstantiateSlot("MaleHands"); umaData.umaRecipe.slotDataList[4].SetOverlayList(umaData.umaRecipe.slotDataList[3].GetOverlayList()); umaData.umaRecipe.slotDataList[5] = slotLibrary.InstantiateSlot("MaleLegs"); umaData.umaRecipe.slotDataList[5].SetOverlayList(umaData.umaRecipe.slotDataList[3].GetOverlayList()); umaData.umaRecipe.slotDataList[6] = slotLibrary.InstantiateSlot("MaleFeet"); umaData.umaRecipe.slotDataList[6].SetOverlayList(umaData.umaRecipe.slotDataList[3].GetOverlayList()); umaData.umaRecipe.slotDataList[3].AddOverlay(overlayLibrary.InstantiateOverlay("MaleUnderwear01")); umaData.umaRecipe.slotDataList[5].AddOverlay(overlayLibrary.InstantiateOverlay("MaleUnderwear01")); umaData.umaRecipe.slotDataList[0].AddOverlay(overlayLibrary.InstantiateOverlay("MaleEyebrow01",Color.black)); } // Use this for initialization void Start () { GenerateUMA(); } // Update is called once per frame void Update () { if(bodyMass!=umaDnaHuman.upperMuscle) { SetBodyMass(bodyMass); umaData.isShapeDirty = true; umaData.Dirty(); } } void SetBodyMass(float mass) { umaDnaHuman.upperMuscle = mass; umaDnaHuman.upperWeight = mass; umaDnaHuman.lowerMuscle = mass; umaDnaHuman.lowerWeight = mass; umaDnaHuman.armWidth = mass; umaDnaHuman.forearmWidth = mass; } } 

这是图像。 我希望他能和椅子一样大 在这里输入图像说明

我把UMA作为一个游戏对象的孩子。 我写了一个附加到游戏对象的脚本,将更改大小的变换大小更改为更新函数中的集合Vector3(我认为在生成UMA后必须更改变换值)。

  private Vector3 usualSize = new Vector3(3, 3, 3); private bool isFirstUpdate=true; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if(isFirstUpdate) { this.gameObject.transform.localScale = usualSize; isFirstUpdate=false; } }