VRMLookAtBlendShapeApplyer limit to 1.0

This commit is contained in:
ousttrue 2018-09-26 20:42:55 +09:00
parent c5ee83f5b9
commit 08efedbab9

View File

@ -50,26 +50,26 @@ namespace VRM
{
// Left
m_propxy.SetValue(BlendShapePreset.LookRight, 0, !m_notSetValueApply); // clear first
m_propxy.SetValue(BlendShapePreset.LookLeft, Horizontal.Map(-yaw), !m_notSetValueApply);
m_propxy.SetValue(BlendShapePreset.LookLeft, Mathf.Clamp(Horizontal.Map(-yaw), 0, 1.0f), !m_notSetValueApply);
}
else
{
// Right
m_propxy.SetValue(BlendShapePreset.LookLeft, 0, !m_notSetValueApply); // clear first
m_propxy.SetValue(BlendShapePreset.LookRight, Horizontal.Map(yaw), !m_notSetValueApply);
m_propxy.SetValue(BlendShapePreset.LookRight, Mathf.Clamp(Horizontal.Map(yaw), 0, 1.0f), !m_notSetValueApply);
}
if (pitch < 0)
{
// Down
m_propxy.SetValue(BlendShapePreset.LookUp, 0, !m_notSetValueApply); // clear first
m_propxy.SetValue(BlendShapePreset.LookDown, VerticalDown.Map(-pitch), !m_notSetValueApply);
m_propxy.SetValue(BlendShapePreset.LookDown, Mathf.Clamp(VerticalDown.Map(-pitch), 0, 1.0f), !m_notSetValueApply);
}
else
{
// Up
m_propxy.SetValue(BlendShapePreset.LookDown, 0, !m_notSetValueApply); // clear first
m_propxy.SetValue(BlendShapePreset.LookUp, VerticalUp.Map(pitch), !m_notSetValueApply);
m_propxy.SetValue(BlendShapePreset.LookUp, Mathf.Clamp(VerticalUp.Map(pitch), 0, 1.0f), !m_notSetValueApply);
}
#pragma warning restore 0618
}