unity htc vive 朝所视前方移动

 //headCamer为定义的相机,头显相机

Vector3 target = new Vector3(headCamera.transform.forward.x, 0, headCamera.transform.forward.z);

//只取X,Z轴,避免朝地面移动时入土..
 player.  transform.Translate(target* moveSpeed * Time.deltaTime, Space.World);

你可能感兴趣的:(unity htc vive 朝所视前方移动)