i used this code for AR camera in version 2.1 but some script is change so plz. help me to correct this
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.ARFoundation;
public class PlaceOnPlane : MonoBehaviour {
private ARSessionOrigin sessionOrigin;
private List hits;
public GameObject model;
public GameObject canvas;
// Start is called before the first frame update
void Start() {
sessionOrigin = GetComponent();
hits = new List();
model.SetActive(false);
canvas.SetActive(false);
}
// Update is called once per frame
void Update() {
if (Input.touchCount == 0)
return;
Touch touch = Input.GetTouch(0);
if (sessionOrigin.Raycast(touch.postion, hits, UnityEngine.Experimental.XR.TrackableType.PlaneWithPolygon))
{
Pose pose = hits[0].pose;
if (!model.activeInHierarchy)
{
model.SetActive(true);
model.transform.position = pose.position;
model.transform.rotation = pose.rotation;
canvas.SetActive(true);
}
else
{
model.transform.position = pose.position;
}
}
}
}