Greetings Unity Community,
I am new to Unity and Unity MARS both.
Why exactly do I want: Designing Sniper for AR FPS game I am trying to make
What I did:
I have been trying to use “Zoom In” feature in AR camera of Unity. I tried using it via FieldOfView() and it seems to be working fine while playing it in Simulation View of Unity(using T & Y) but when I run it on Android it does not work.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraShift : MonoBehaviour
{
//This is the field of view that the Camera has
float m_FieldOfView;
void Start()
{
//Start the Camera field of view at 60
m_FieldOfView = 60.0f;
}
void Update()
{
//Update the camera's field of view to be the variable returning from the Slider
Camera.main.fieldOfView = m_FieldOfView;
if (Input.GetKeyDown(KeyCode.T))
{ m_FieldOfView = 15.0f; }
if (Input.GetKeyDown(KeyCode.Y))
{ m_FieldOfView = 60.0f; }
if (Input.touchCount > 0)
{
var touch = Input.GetTouch(0);
if (touch.position.x < Screen.width / 2)
{
m_FieldOfView = 15.0f;
}
}
}
}
So, I even tried to start with a different field of view(Changed it in Unity Main camera) but the game started with its regular field of view and not what I changed it to{Though it worked fine in Simulation View}.
I read few posts about Vuforia’s Camera Zoom and most of them mentioned that it is not possible but they were old and they weren’t about Unity Mars so posted here.
Device I am using: Samsung Galaxy M30S(It supports AR as rest of the game I created works fine)