当前位置:网站首页>[ar learning] - II. Environment construction
[ar learning] - II. Environment construction
2022-07-23 20:03:00 【JH_ Cao】
1. install Unity Hub
- Preface
We only do iOS End , An zhuodang doesn't engage in , But Android can refer to
Official website
- As shown in the figure below , download

- Add the template
- Additional explanation
In preferences , You can set the language




4. Open the interface 
2. doSomethings
- Additional explanation
Hierarchy: Meaning of hierarchy
- Lower left
Project–>Assetsin
- establish
PrefabsFolder - establish
ScriptsFolder
- stay Hierarchy Blank space of , Right click , establish
AR Default Plane

2. take AR Default Plane Drag and drop to Prefabs In the folder
3. Scenes in , modify Scene The name is HelloWorld
4. add to AR Plane Manger
5. Generally, there will be AR Plane Manager, Then we won't add any more -_- !
Click Replace
AR Plane ManagerMediumPlane Prefab, Replace withPrefabs1
In the folder we created
ScriptsAdd C# Script
To configure AppController
- Will just create C# Rename the script file to
AppController, double-click , If your computer hasVisual Studio Code, Will open
- scripting
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.ARFoundation;
using UnityEngine.XR.ARSubsystems;
[RequireComponent(typeof(ARRaycastManager))]
public class AppCoontroller : MonoBehaviour
{
public GameObject spawnPrefab;
static List<ARRaycastHit> Hits;
private ARRaycastManager mRaycastManager;
private GameObject spawnedObject = null;
// Start is called before the first frame update
void Start()
{
Hits = new List<ARRaycastHit>();
mRaycastManager = GetComponent<ARRaycastManager>();
}
// Update is called once per frame
void Update()
{
if (Input.touchCount == 0)
{
return;
}
var touch = Input.GetTouch(0);
if (mRaycastManager.Raycast(touch.position, Hits, TrackableType.PlaneWithinPolygon | TrackableType.PlaneWithinBounds))
{
var hitPose = Hits[0].pose;
if (spawnedObject == null)
{
spawnedObject = Instantiate(spawnPrefab, hitPose.position, hitPose.rotation);
}
else
{
spawnedObject.transform.position = hitPose.position
}
}
}
}
3. Ready to run
- Add one Cube

边栏推荐
- Atcoder regular contest 144 [VP record]
- 使用 mysqldump 或 mydumper 配置 MySQL 主从复制
- Latex (KAtex) CSDN Greek alphabet representation, mathematical symbols, set symbols, special marks
- Powercli management VMware vCenter batch deployment export import
- Element positioning in selenium is correct, but the operation fails. Six solutions are all finalized
- 2022DASCTF MAY
- 千呼万唤,5G双卡双通到底有多重要?
- How should testing cope with the new development mode?
- Paddle implementation, multidimensional time series data enhancement, mixup (using beta distribution to make continuous random numbers)
- AtCoder——Subtree K-th Max
猜你喜欢

重装系统后故障(报错:reboot and select proper boot deviceor insert boot media in selected boot device)

MySQL master-slave replication

能量原理與變分法筆記19:最小餘能原理+可能功原理

能量原理与变分法笔记19:最小余能原理+可能功原理

Compiler llvm MLIR introductions llvm backend instruction

搭建自己的目标检测环境,模型配置,数据配置 MMdetection

梅科尔工作室-华为14天鸿蒙设备开发实战笔记五

Robot decision-making system based on self-learning (daki technology, Zhao kaiyong)

能量原理与变分法笔记15:微元法的求解
![Atcoder regular contest 144 [VP record]](/img/8c/bcffb95cb709087103bb79b8a358d1.png)
Atcoder regular contest 144 [VP record]
随机推荐
Edge cloud | 1. overview
R language data The table package performs data grouping aggregation statistical transformations and calculates the grouping minimum value (min) of dataframe data
项目实战第九讲--运营导入导出工具
Atcoder regular contest 144 [VP record]
Cannot read properties of null (reading ‘pickAlgorithm‘)
Idea select code generation method
Leetcode 216. combined sum III
Mekol Studio - Little Bear Development Notes 2
next数值型数据类型()出现输入错误后,下次依然能正常输入
[unity project practice] level unlocking
使用多态时,判断能否向下转型的两种思路
梅科尔工作室-小熊派开发笔记3
Configure MySQL master-slave replication with mysqldump or mydumper
2022DASCTF MAY
When does MySQL use table locks and row locks?
Lecture 9 of project practice -- operation import and export tool
web安全入门-ssh测试与防御
R language uses the gather function of tidyr package to convert a wide table to a long table (wide table to long table), the first parameter specifies the name of the new data column generated from th
Powercli moves virtual machines from host01 host to host02 host
Meiker Studio - Huawei 14 day Hongmeng equipment development practical notes 4