/****************************************************************************
* Copyright 2019 Nreal Techonology Limited. All rights reserved.
*
* This file is part of NRSDK.
*
* https://www.nreal.ai/
*
*****************************************************************************/
using UnityEngine;
namespace NRKernal.NRExamples
{
/// A trackable image behaviour.
public class TrackableImageBehaviour : MonoBehaviour
{
/// The detected marker.
private NRTrackableImage m_DetectedMarker;
/// Initializes this object.
/// The marker.
public void Initialize(NRTrackableImage marker)
{
m_DetectedMarker = marker;
}
/// Updates this object.
private void Update()
{
if (m_DetectedMarker != null && m_DetectedMarker.GetTrackingState() == TrackingState.Tracking)
{
Vector2 size = m_DetectedMarker.Size;
transform.localScale = new Vector3(size.x, transform.localScale.y, size.y);
}
}
}
}