[UE4]添加手柄

一、在上一节的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里面的相机是否有位置偏移。

  

  

猜你喜欢

转载自www.cnblogs.com/timy/p/10333460.html