浏览代码

PR feedback

/1.5-preview
Jimmy Alamparambil 6 年前
当前提交
fb5329d4
共有 2 个文件被更改,包括 11 次插入11 次删除
  1. 4
      Assets/Prefabs/FaceBlendShapes.prefab
  2. 18
      Assets/Scripts/ARFaceArkitBlendShapeVisualizer.cs

4
Assets/Prefabs/FaceBlendShapes.prefab


m_Script: {fileID: 11500000, guid: 77136493c3caf4805ac5a602f75072e0, type: 3}
m_Name:
m_EditorClassIdentifier:
CoefficientScale: 100
SkinnedMeshRenderer: {fileID: 137740007780104604}
coefficientScale: 100
skinnedMeshRenderer: {fileID: 137740007780104604}
--- !u!1 &1342913298729328
GameObject:
m_ObjectHideFlags: 0

18
Assets/Scripts/ARFaceArkitBlendShapeVisualizer.cs


[RequireComponent(typeof(ARFace))]
public class ARFaceArkitBlendShapeVisualizer : MonoBehaviour
{
public float CoefficientScale = 100.0f;
public SkinnedMeshRenderer SkinnedMeshRenderer;
[SerializeField]
float coefficientScale = 100.0f;
[SerializeField]
SkinnedMeshRenderer skinnedMeshRenderer;
ARFace m_Face;
ARKitFaceSubsystem arkitFaceSubsystem;

s_FaceArkitBlendShapeCoefficients = new List<XRFaceArkitBlendShapeCoefficient>();
m_Face = GetComponent<ARFace>();
CreateFeatureBlendMapping();
}
void CreateFeatureBlendMapping()

void SetVisible(bool visible)
{
if (SkinnedMeshRenderer == null) return;
if (skinnedMeshRenderer == null) return;
SkinnedMeshRenderer.enabled = visible;
skinnedMeshRenderer.enabled = visible;
}
void UpdateVisibility()

void UpdateFaceFeatures()
{
if (SkinnedMeshRenderer == null || !SkinnedMeshRenderer.enabled)
if (skinnedMeshRenderer == null || !skinnedMeshRenderer.enabled)
{
return;
}

string mappedBlendShapeName;
if (m_FaceArkitBlendShapeNameMap.TryGetValue(xrFaceFeatureCoefficient.arkitBlendShapeLocation, out mappedBlendShapeName))
{
int blendShapeIndex = SkinnedMeshRenderer.sharedMesh.GetBlendShapeIndex (strPrefix + mappedBlendShapeName);
int blendShapeIndex = skinnedMeshRenderer.sharedMesh.GetBlendShapeIndex (strPrefix + mappedBlendShapeName);
SkinnedMeshRenderer.SetBlendShapeWeight (blendShapeIndex, xrFaceFeatureCoefficient.coefficient * CoefficientScale);
skinnedMeshRenderer.SetBlendShapeWeight (blendShapeIndex, xrFaceFeatureCoefficient.coefficient * coefficientScale);
}
}
}
正在加载...
取消
保存