一、在上一節的VRPawnBase中,再添加2個Motion Controller,分別命名為:LeftMotionController、RightMotionController,分別代表左右手柄。

設置Motion Controller的Hand屬性,表示左右手柄:LeftMotionController.Hand=Left、RightMotionController.Hand=Right。

二、MotionController只是一個控制器,沒有實體,分別選中LeftMotionController和RightMotionController添加一個Mesh(Static Mesh、Skeletal Mesh、ChildActor都可以,本例使用Static Mesh)作為子節點,分別命名為:LeftHandMesh、RightHandMesh。

三、設置LeftHandMesh.Static Mesh = VivePreControllerMesh,RightHandMesh.Static Mesh = VivePreControllerMesh。

VivePreControllerMesh是引擎自帶的一個手柄模型,如果沒有找到,則勾選View Options.Show Engine Content(顯示引擎資源),就能找到VivePreControllerMesh了。

四、運行游戲,在現實中拿着左右2個手柄左右晃動,可以看到游戲場景里面的手柄也會跟着左右晃動。把現實中的2個手柄放在地上,如果游戲場景里面的手柄也跟着放在地上,則表示高度設置沒問題。

如果高度不正確的話,檢查VRPawnBase里面的相機是否有位置偏移。

