blend shapes added for character

This commit is contained in:
2024-04-18 16:27:57 +01:00
parent 3b3b39a72a
commit 8760082980
7 changed files with 3530 additions and 20 deletions

View File

@@ -0,0 +1,45 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ModifyBlendShape : MonoBehaviour
{
private SkinnedMeshRenderer m_SkinnedMeshRenderer;
private void Awake(){
m_SkinnedMeshRenderer = this.GetComponent<SkinnedMeshRenderer>();
StartCoroutine(BlendShapeRoutineEyes());
//StartCoroutine(BlendShapeRoutineMouth());
}
private IEnumerator BlendShapeRoutineEyes(){
yield return new WaitForSecondsRealtime(Random.Range(5f, 10f));
// Blink!
m_SkinnedMeshRenderer.SetBlendShapeWeight(0, Mathf.SmoothStep(0, 100, 1));
m_SkinnedMeshRenderer.SetBlendShapeWeight(1, Mathf.SmoothStep(0, 100, 1));
yield return new WaitForSecondsRealtime(Random.Range(0.25f, 0.75f));
m_SkinnedMeshRenderer.SetBlendShapeWeight(0, Mathf.SmoothStep(0, 100, 0));
m_SkinnedMeshRenderer.SetBlendShapeWeight(1, Mathf.SmoothStep(0, 100, 0));
StartCoroutine(BlendShapeRoutineEyes());
}
private void Update(){
BlendNoise();
}
private void BlendNoise(){
float noise = Mathf.PerlinNoise(Time.time * 0.1f, Time.time * 0.1f);
// m_SkinnedMeshRenderer.SetBlendShapeWeight(0, Mathf.SmoothStep(0, 100, noise));
// m_SkinnedMeshRenderer.SetBlendShapeWeight(1, Mathf.SmoothStep(0, 100, noise));
m_SkinnedMeshRenderer.SetBlendShapeWeight(2, Mathf.SmoothStep(0, 75, noise));
m_SkinnedMeshRenderer.SetBlendShapeWeight(3, Mathf.SmoothStep(0, 75, noise));
}
private IEnumerator BlendShapeRoutineMouth(){
yield return new WaitForSeconds(1);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 88580b94a44cc5c4a8f212083bc0e0fd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: