tips:之前入门教程如果没有左手柄,查看一下自己的手柄设置,左右手柄,

 
Helloworld型
1.基础传送,调式地面传送功能,通过手柄默认的“握手键”,瞬移,
VR头显,添加Teleportation Provider组件,其中System属性,添加本身对象,头显对象赋值地面属性,


可以瞬移的设置如下设置三步:

Locomotion System 视角不容易倒
 

更改移动按键:
握手按键(中指)改为扳手按键(食指)
 
 
 
 
 
 
grip改成triggerPressed
2.对象移动与自身移动
控制物体移动:编写脚本用手柄控制球体的前后左右移动
核心代码:
using UnityEngine.XR
    void Update()
     {
         //二维向量移动偏移量
         Vector2 vec2DAxis = Vector2.zero;
         InputDevices.GetDeviceAtXRNode(XRNode.LeftHand).TryGetFeatureValue(CommonUsages.primary2DAxis, out vec2DAxis);
         transform.position = new Vector3(transform.position.x +vec2DAxis.x*Time.deltaTime,transform.position.y, transform.position.z+vec2DAxis.y * Time.deltaTime);
     }

 
 


















