Skip to content

Commit

Permalink
Scale weight of blend shape
Browse files Browse the repository at this point in the history
  • Loading branch information
mochi-neko committed Aug 9, 2023
1 parent e0c60ad commit 08dec55
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ public void MorphInto(EyelidSample sample)
{
if (indexMap.TryGetValue(sample.eyelid, out var index))
{
skinnedMeshRenderer.SetBlendShapeWeight(index, sample.weight);
skinnedMeshRenderer.SetBlendShapeWeight(index, sample.weight * 100f);
}
}

public float GetWeightOf(Eyelid eyelid)
{
if (indexMap.TryGetValue(eyelid, out var index))
{
return skinnedMeshRenderer.GetBlendShapeWeight(index);
return skinnedMeshRenderer.GetBlendShapeWeight(index) / 100f;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ public void MorphInto(EmotionSample<TEmotion> sample)
{
if (indexMap.TryGetValue(sample.emotion, out var index))
{
skinnedMeshRenderer.SetBlendShapeWeight(index, sample.weight);
skinnedMeshRenderer.SetBlendShapeWeight(index, sample.weight * 100f);
}
}

public float GetWeightOf(TEmotion emotion)
{
if (indexMap.TryGetValue(emotion, out var index))
{
return skinnedMeshRenderer.GetBlendShapeWeight(index);
return skinnedMeshRenderer.GetBlendShapeWeight(index) / 100f;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void MorphInto(LipSample sample)
{
if (indexMap.TryGetValue(sample.viseme, out var index))
{
skinnedMeshRenderer.SetBlendShapeWeight(index, sample.weight);
skinnedMeshRenderer.SetBlendShapeWeight(index, sample.weight * 100f);
}
else if (sample.viseme is Viseme.sil)
{
Expand All @@ -41,7 +41,7 @@ public float GetWeightOf(Viseme viseme)
{
if (indexMap.TryGetValue(viseme, out var index))
{
return skinnedMeshRenderer.GetBlendShapeWeight(index);
return skinnedMeshRenderer.GetBlendShapeWeight(index) / 100f;
}
else
{
Expand Down

0 comments on commit 08dec55

Please sign in to comment.