using UnityEngine; namespace Normal.Realtime.Examples { public class VoiceMouthMove : MonoBehaviour { public SkinnedMeshRenderer[] skinned; private RealtimeAvatarVoice _voice; private float _mouthSize; void Awake() { _voice = GetComponent(); } void Update() { if (skinned != null) //not sure whether work or not { float targetMouthSize = Mathf.Lerp(0.1f, 1.0f, _voice.voiceVolume); _mouthSize = Mathf.Lerp(_mouthSize, targetMouthSize, 30.0f * Time.deltaTime); foreach (SkinnedMeshRenderer s in skinned)//not sure whether work or not { s.SetBlendShapeWeight(41, _mouthSize * 100); s.SetBlendShapeWeight(17, _mouthSize * 50); s.SetBlendShapeWeight(6, _mouthSize * 20); } } } } }
top of page

Debug Log | 错题本

  • 作家相片: fang ma
    fang ma
  • 2021年12月27日
  • 讀畢需時 1 分鐘

已更新:2021年12月28日


【2021 12 27】

Quaternion四元数的使用

Bug: Rotation不动


错误代码

transform.rotation = Quaternion.Euler(-face.transform.rotation.x, -face.transform.rotation.y, face.transform.rotation.z);

实现代码

transform.rotation = new Quaternion(-face.transform.rotation.x, -face.transform.rotation.y, face.transform.rotation.z, face.transform.rotation.w);

Comments


  • Facebook
  • Twitter
  • LinkedIn

©2021 by Mianzi Ltd

bottom of page