用unity+Vuforia制作了一个简单的AR演示,实现用虚拟按钮进行交互,用手势控制模型旋转和缩放。
视频链接:https://www.bilibili.com/video/BV1Ny4y147aW/
关于Vuforia sdk的安装,unity的安卓环境配置和打包apk,网上教程很多,这里就不介绍了,主要放一下虚拟按钮和手势控制的代码,供大家参考学习。
我的unity版本是2019.4.24f1c1,Vuforia sdk版本是目前最新版9.8.5,人物模型是从unity商店免费下载的。
Vuforia虚拟按钮
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Vuforia;
public class VbController : MonoBehaviour
{
public GameObject girl;
private Animator animator;
void Start()
{
girl = GameObject.Find("girl");
animator = girl.GetComponent<Animator>();
var vbbs = GetComponentsInChildren<VirtualButtonBehaviour>();
for (int i = 0; i <