An open API service indexing awesome lists of open source software.

https://github.com/stefanocecere/gamelab_ar_unity

Game Lab for Augmented and Mixed Reality with Unity
https://github.com/stefanocecere/gamelab_ar_unity

arcore arfoundation arkit augmented-reality examples gamedev gamelab2042 mixed-reality unity

Last synced: about 1 month ago
JSON representation

Game Lab for Augmented and Mixed Reality with Unity

Awesome Lists containing this project

README

          

# AR demo lessons

Unity version used: 2021.2.x

supported Android devices: https://developers.google.com/ar/discover/supported-devices
iOS: iPhone o iPad con iOS >= 12.0

---

creo Prefab

aggiungo package ARFoundation e ARcore

creo Prefab Plane ->
Empty
AR Plane
AR Plane visualizer
mesh filter
mesh rendererd
LInerendered (0,01) e no world space
creo materiale tranparent

poi script ARPlace

```
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.ARFoundation;
using UnityEngine.XR.ARSubsystems;

namespace MyDemo
{
public class ARPlaceOnTap : MonoBehaviour
{
public GameObject gameToInstatiate;

private GameObject spawnedObject;
private ARRaycastManager raycatManager;
private Vector2 touchPosition;
static List hits = new List();

private void Awake()
{
raycatManager = GetComponent();
}

void Update()
{
if (Input.touchCount > 0) {
touchPosition = Input.GetTouch(0).position;

if (raycatManager.Raycast(touchPosition, hits, TrackableType.PlaneWithinPolygon)) {

var hitPose = hits[0].pose;

if (spawnedObject == null) {
spawnedObject = Instantiate(gameToInstatiate, hitPose.position, hitPose.rotation);
} else {
spawnedObject.transform.position = hitPose.position;
}
}
}

}
}
}
```