/**************************************************************************** * Copyright 2019 Nreal Techonology Limited. All rights reserved. * * This file is part of NRSDK. * * https://www.nreal.ai/ * *****************************************************************************/ namespace NRKernal { using UnityEngine; /// A nr trackable image behaviour. public class NRTrackableImageBehaviour : NRTrackableBehaviour { /// The aspect ratio. [HideInInspector, SerializeField] private float m_AspectRatio; /// The width. [HideInInspector, SerializeField] private float m_Width; /// The height. [HideInInspector, SerializeField] private float m_Height; /// The tracking image database. [HideInInspector, SerializeField] private string m_TrackingImageDatabase; /// Awakes this object. private void Awake() { #if !UNITY_EDITOR MeshRenderer meshRenderer = GetComponent(); if (meshRenderer != null) Destroy(meshRenderer); MeshFilter mesh = GetComponent(); if (mesh != null) Destroy(mesh); #endif } #if UNITY_EDITOR private void Update() { float extent = transform.lossyScale.x * 1000; if (NREmulatorManager.Instance.IsInGameView(transform.position)) { NREmulatorTrackableProvider.UpdateTrackableData (transform.position, transform.rotation, extent, extent, (uint)DatabaseIndex, TrackingState.Tracking); } else { NREmulatorTrackableProvider.UpdateTrackableData (transform.position, transform.rotation, extent, extent, (uint)DatabaseIndex, TrackingState.Stopped); } } #endif } }