mirror of
https://projects.caleb-brown.dev/UDRI-XRT/UDRIGEEKCup2024.git
synced 2025-01-22 07:08:51 -05:00
31 lines
674 B
C#
31 lines
674 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityAtoms.BaseAtoms;
|
|
using UnityEngine;
|
|
|
|
public class ARContentParent : MonoBehaviour
|
|
{
|
|
public GameObjectEvent anchorUpdatedEvent;
|
|
|
|
private void OnEnable()
|
|
{
|
|
anchorUpdatedEvent.Register(OnAnchorUpdated);
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
anchorUpdatedEvent.Unregister(OnAnchorUpdated);
|
|
}
|
|
|
|
|
|
private void OnAnchorUpdated(GameObject anchor)
|
|
{
|
|
transform.position = anchor.transform.position;
|
|
|
|
Vector3 rot = anchor.transform.rotation.eulerAngles;
|
|
|
|
transform.rotation = Quaternion.Euler(0,rot.y,0);
|
|
}
|
|
}
|