- Home /
Question by
GenslerNY · Jan 30, 2019 at 10:44 PM ·
triggerscamerasbox collider
camera triggers
Hi All,
I'm trying to set up an AR app, where when a camera gets into an area, it triggers an object to appear. I've got an object in the model with a collider, and a script attached:
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Trigger : MonoBehaviour {
// Use this for initialization
public GameObject LinearSeatCount;
void Start()
{
LinearSeatCount.SetActive(false);
}
void OnTriggerEnter(Collider CountTrigger)
{
if (CountTrigger.gameObject.tag == "CameraBox")
{
LinearSeatCount.SetActive(true);
}
}
}
I parented a cube to the AR camera, turned off the mesh renderer, added a box collider, set Is Trigger, and added a rigidbody, still no dice.
Is it possible to do it this way or is just the script that is not working?
Thanks in advance for any feedback.
Comment