
using MMMaellon.LightSync;
using UdonSharp;
using UnityEngine;
using VRC.SDK3.Components;
using VRC.SDKBase;
using VRC.Udon;

[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
public class CameraAutoLevel : UdonSharpBehaviour
{
	public LightSync Camera;

    public override void Interact()
	{
		if (Utilities.IsValid(Camera))
		{
			Vector3 oldRotation = Camera.gameObject.transform.eulerAngles;
			Camera.TeleportToWorldSpace(
				Camera.gameObject.transform.position,
				Quaternion.Euler(oldRotation.x, oldRotation.y, 0.0f),
				true);
		}
	}
}
