从AR过渡到非AR

时间:2022-12-01 11:58:22

I am making a top-down strategy game using Vuforia and want to make transition to fps mode. The problem is that as soon as I take my camera away from image target,my environment disppears and the game freezes. I have tried changing the parent of all the objects from image target to another object,switching the camera,but no luck. This is the code that i have used to switch cameras.

我正在使用Vuforia制作一个自上而下的策略游戏,并希望转换到fps模式。问题是,只要我将相机从图像目标移开,我的环境就会消失,游戏会冻结。我尝试将所有对象的父对象从图像目标更改为另一个对象,切换摄像头,但没有运气。这是我用来切换相机的代码。

void change(){
      cams [c%2].GetComponent <Camera> ().enabled = false;
     cams[(c+1)%2].GetComponent <Camera> ().enabled = true;
     if (c % 2 == 1) {
         scene.transform.parent = imageTarget.transform;
     } else {
         scene.transform.parent = transform;
      }
     c++;
 }

I want to use the rotation of AR-camera as the rotation of my non-AR-camera so that user can see around in the scene by turning the AR-camera(similar to vr style but without vr headset).

我想使用AR相机的旋转作为非AR相机的旋转,这样用户就可以通过转动AR相机在场景中看到周围(类似于vr风格但没有vr耳机)。

Can anyone help?

有人可以帮忙吗?

1 个解决方案

#1


1  

My suggestion is to first of all use Extended Tracking (option under the ARCamera in your scene).

我的建议是首先使用扩展跟踪(场景中的ARCamera选项)。

If you want to get an fps view you could enlarge all the children (objects) of your Image Target in such a way that they are close to room-scale. By doing that you don't have to switch cameras and with the Extended Tracking enabled, you can look around and view the enlarged environment.

如果你想获得一个fps视图,你可以放大你的图像目标的所有子(物体),使它们接近室内尺度。通过这样做,您无需切换摄像头,并且启用了扩展跟踪,您可以环顾四周并查看放大的环境。

#1


1  

My suggestion is to first of all use Extended Tracking (option under the ARCamera in your scene).

我的建议是首先使用扩展跟踪(场景中的ARCamera选项)。

If you want to get an fps view you could enlarge all the children (objects) of your Image Target in such a way that they are close to room-scale. By doing that you don't have to switch cameras and with the Extended Tracking enabled, you can look around and view the enlarged environment.

如果你想获得一个fps视图,你可以放大你的图像目标的所有子(物体),使它们接近室内尺度。通过这样做,您无需切换摄像头,并且启用了扩展跟踪,您可以环顾四周并查看放大的环境。