().material.mainTexture = webcamTexture; } void Update() { if (webcamTexture != null && webcamTexture.isPlaying) { try { Color32[] pixels = webcamTexture.GetPixels32(); var result = reader.Decode(pixels, webcamTexture.width, webcamTexture.height); if (result != null) { /* 파싱 후 변"> ().material.mainTexture = webcamTexture; } void Update() { if (webcamTexture != null && webcamTexture.isPlaying) { try { Color32[] pixels = webcamTexture.GetPixels32(); var result = reader.Decode(pixels, webcamTexture.width, webcamTexture.height); if (result != null) { /* 파싱 후 변"> ().material.mainTexture = webcamTexture; } void Update() { if (webcamTexture != null && webcamTexture.isPlaying) { try { Color32[] pixels = webcamTexture.GetPixels32(); var result = reader.Decode(pixels, webcamTexture.width, webcamTexture.height); if (result != null) { /* 파싱 후 변">
using UnityEngine;
using ZXing;
public class QRCodeScanner : MonoBehaviour
{
private WebCamTexture webcamTexture;
private IBarcodeReader reader;
void Start()
{
Debug.Log("===== QRCodeScanner START() 실행됨 =====");
var devices = WebCamTexture.devices;
for(int i = 0; i< devices.Length; i++)
{
Debug.Log($"Camera detected {i}: {devices[i].name}");
}
webcamTexture = new WebCamTexture(devices[0].name);
webcamTexture.Play();
reader = new BarcodeReader();
GetComponent<Renderer>().material.mainTexture = webcamTexture;
}
void Update()
{
if (webcamTexture != null && webcamTexture.isPlaying)
{
try
{
Color32[] pixels = webcamTexture.GetPixels32();
var result = reader.Decode(pixels, webcamTexture.width, webcamTexture.height);
if (result != null)
{
/* 파싱 후 변수에 저장*/
Debug.Log("QR Code Detected: " + result.Text);
}
}
catch {}
}
}
}
public class NavigationManager : MonoBehaviour
{
public static NavigationManager Instance;
private Vector2 start;
private string currentFloor;
private void Awake()
{
Instance = this;
}
public void SetStartPoint(Vector2 startPos, string floor)
{
start = startPos;
currentFloor = floor;
Debug.Log($"A* 시작 위치: {start}, 층: {currentFloor}");
// A* 탐색 실행
RunPathfinding();
}
void RunPathfinding()
{
// 여기에 A* 알고리즘 적용
List<Vector2> path = AStar.FindPath(start, goal);
// AR 경로 시각화로 전달
ARPathRenderer.Instance.RenderPath(path);
}
}