SW 중심대학 OSS GIT 서버 박건태, 이승준, 고기완, 이준호 새로운 배포
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

36 lines
1008 B

using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.XR.ARFoundation;
[RequireComponent(typeof(ARRaycastManager))]
public class Selection__1 : MonoBehaviour
{
public GameObject placePrefab;
private ARRaycastManager aRRaycastManager;
private static List<ARRaycastHit> hits = new List<ARRaycastHit>();
private void Awake()
{
aRRaycastManager = GetComponent<ARRaycastManager>();
}
private void Update()
{
if (Input.touchCount > 0)
{
Touch touch = Input.GetTouch(0);
if (touch.phase == TouchPhase.Began)
{
var touchPostion = touch.position;
if (aRRaycastManager.Raycast(touchPostion, hits, UnityEngine.XR.ARSubsystems.TrackableType.Planes)){
var hitPose = hits[0].pose;
Instantiate(placePrefab, hitPose.position, hitPose.rotation);
}
}
}
}
}