Unity VRIK 使用动态添加 手部动画

首先导入VRIK 插件 , 没有steamVRIK  的话,在VRIK文件里有这个组件, 再次导入即可

可以自己制作手部动画:握拳  舒展  特殊手势   用Animation  作,很简单  ,下面几种图片是设置   

代码:

  /// <summary>
    /// 给手臂添加 VRIK  组件
    /// </summary>
    public void AddVRIK(GameObject avatar)
    {
        avatar.AddComponent<VRIK>();

        avatar.GetComponent<VRIK>().solver.leftArm.target = GameObject.Find("LArmHand").transform;
        avatar.GetComponent<VRIK>().solver.rightArm.target = GameObject.Find("RArmHand").transform;
        avatar.GetComponent<VRIK>().solver.spine.headTarget = GameObject.Find("NeckHead").transform;


        avatar.AddComponent<VRIKAvatarScaleCalibrationSteamVR>();
        avatar.GetComponent<VRIKAvatarScaleCalibrationSteamVR>().ik = avatar.GetComponent<VRIK>();
        avatar.GetComponent<VRIKAvatarScaleCalibrationSteamVR>().scaleMlp = 1.03f;
        avatar.GetComponent<VRIKAvatarScaleCalibrationSteamVR>().grabPinch = SteamVR_Input.GetBooleanAction("GrabPinch");
    }

 

posted @ 2020-07-07 19:51  D个人笔记  阅读(1774)  评论(0编辑  收藏  举报