我正在使用带有 Daydream 支持的 Unity 技术预览来测试带有 Daydream 视图和控制器的像素。
我已经成功地将我的场景部署到我的设备上,一切都按预期工作。
但是,对于我的生活,我无法让相机传送。我指向地板,可以将其他物体传送到我指向的位置,但不能传送相机。事实上,当我检查变换时,相机传送正常,但我在 Pixel 上看到的视图没有更新。我必须在 GVRViewer 脚本上调用什么吗?
以下是相关代码:
RaycastHit hitInfo;
Vector3 rayDirection = GvrController.Orientation * Vector3.forward;
if (Physics.Raycast(controllerPivot.transform.position, rayDirection, out hitInfo)) {
if (hitInfo.collider && hitInfo.collider.gameObject) {
SetSelectedObject(hitInfo.collider.gameObject);
//Teleport on click
if (selectedObject == floor) {
if (GvrController.ClickButtonDown) {
selectedObject.GetComponent<Renderer>().material = cubeActiveMaterial;
controllerPivot.transform.position = new Vector3 (hitInfo.point.x, controllerPivot.transform.position.y, hitInfo.point.z);
playerCamera.transform.position = new Vector3 (hitInfo.point.x, playerCamera.transform.position.y, hitInfo.point.z);
gvrControllerMain.transform.position = new Vector3 (hitInfo.point.x, gvrControllerMain.transform.position.y, hitInfo.point.z);
}
}
}