---
# System prepended metadata

title: VRIK 修正

---

# VRIK 修正
> VRIK 是玩家動作跟模型綁定的東東
> (頭轉、手動)


## 改寫 VRIKInput

- 改寫裡面的 `GetIKTransform` (行數不見得正確，請自己檢查)

```csharp=42
public void GetIKTransform(Transform VRtransform)
    {
#if UNITY_ANDROID // pico
        headTracker      =           GameObject.Find("Head")?.transform ?? Camera.main.transform;
        leftHandTracker  = GameObject.Find("PvrController0")?.transform ?? GameObject.Find("LeftHand Controller")?.transform;
        rightHandTracker = GameObject.Find("PvrController1")?.transform ?? GameObject.Find("RightHand Controller")?.transform;
#else // vive
        foreach (Transform item in VRtransform)
        {
            if (item.name == "Controller (left)")
            {
                foreach (Transform child in item)
                {
                    if (child.name == "LeftHand")
                    {
                        leftHandTracker = child;
                        //Debug.Log(leftHandTracker.name);
                    }
                }
            }
            if (item.name == "Controller (right)")
            {
                foreach (Transform child in item)
                {
                    if (child.name == "RightHand")
                    {
                        rightHandTracker = child;
                        //Debug.Log(rightHandTracker.name);
                    }
                }
            }
            if (item.name == "Camera")
            {
                foreach (Transform child in item)
                {
                    if (child.name == "Head")
                    {
                        headTracker = child;
                        //Debug.Log(headTracker.name);
                    }
                }
            }
        }
#endif
    }
```