we are working in an Unity game for mobile. Basically it is a scene with 3D characters and a map to see where they are. I would like to know how can I activate the phone camera when I tilt vertically the phone to see the 3D characters inserted in the real world, and return to a map view of the 3D world when I tilt it horizontally. Any ideas if it is possible?
Asked
Active
Viewed 53 times
1 Answers
0
First you have to check in Script in the Update Function you can put Something like this:
using UnityEngine.UI;
public Image image;
void Update()
{
if (Input.deviceOrientation == DeviceOrientation.FaceDown)
image.gameObject.SetActive(true);
}
else
{
image.gameObject.SetActive(false);
}
And in the Image you should add an Script with this content:
void Start ()
{
plane = GameObject.FindWithTag ("Player");
mCamera = new WebCamTexture ();
plane.renderer.material.mainTexture = mCamera;
mCamera.Play ();
}

NivekJump
- 31
- 2