/**************************************************************************** * 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 plane behaviour. public class NRTrackablePlaneBehaviour : NRTrackableBehaviour { /// Starts this object. private void Start() { #if UNITY_EDITOR DatabaseIndex = NREmulatorManager.SIMPlaneID; NREmulatorManager.SIMPlaneID++; #endif #if !UNITY_EDITOR MeshRenderer meshRenderer = GetComponent(); if (meshRenderer != null) Destroy(meshRenderer); MeshFilter mesh = GetComponent(); if (mesh != null) Destroy(mesh); #endif } #if UNITY_EDITOR /// Updates this object. 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 } }