Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

(ARKit) I want to change the value of ARFaceAnchor. Help me plz ㅜㅜ

$
0
0
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.XR.iOS; public class BlendshapeDriver : MonoBehaviour { SkinnedMeshRenderer skinnedMeshRenderer; Dictionary currentBlendShapes; [SerializeField] private GameObject myFace; SkinnedMeshRenderer myFaceRenderer; // Use this for initialization void Start() { myFaceRenderer = myFace.GetComponent(); skinnedMeshRenderer = GetComponent(); if (skinnedMeshRenderer) { UnityARSessionNativeInterface.ARFaceAnchorAddedEvent += FaceAdded; UnityARSessionNativeInterface.ARFaceAnchorUpdatedEvent += FaceUpdated; } } void FaceAdded(ARFaceAnchor anchorData) { currentBlendShapes = anchorData.blendShapes; } void FaceUpdated(ARFaceAnchor anchorData) { currentBlendShapes = anchorData.blendShapes; } // Update is called once per frame void Update() { if (currentBlendShapes != null) { foreach (KeyValuePair kvp in currentBlendShapes) { int blendShapeIndex = skinnedMeshRenderer.sharedMesh.GetBlendShapeIndex("blendShape2." + kvp.Key); Debug.Log("blendShape2." + kvp.Key); if (blendShapeIndex >= 0) { skinnedMeshRenderer.SetBlendShapeWeight(blendShapeIndex, kvp.Value * 100.0f); //myFaceRenderer.SetBlendShapeWeight(blendShapeIndex, kvp.Value * 100.0f); } } } } } The above code is the code that moves the 'sloth' in the ARKit. I want to use this to move my model, but there is a problem. int blendShapeIndex = skinedMeshRender.sharedMesh.GetBlendShapeIndex("blendShape2." + kvp.Key); I want to change the value of the kvp.Key in the code, but I don't know how to change it. If you look at the current value of Debug.Log (kvp.Key); you would like to change the value that comes with "browDown_L" , "browDown_Right" ... to "browDownLeft" , "browDownRight". Please let me know what value I need to change. Please, I've been thinking about it for a few days. ... This is the address of the ARKit I downloaded. https://bitbucket.org/Unity-Technologies/unity-arkit-plugin/overview

Viewing all articles
Browse latest Browse all 4709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>