其他分享
首页 > 其他分享> > Unity VRIK 使用动态添加 手部动画

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");
    }

 

标签:VRIK,GameObject,手部,transform,Unity,avatar,Find,GetComponent
来源: https://www.cnblogs.com/DGJS/p/13262815.html