当前位置:网站首页>Vuforia for unity add button to zoom in and out the model
Vuforia for unity add button to zoom in and out the model
2022-06-09 15:33:00 【Djc8 small yard farmer】
Specifically, the script is attached to the preform prefab On .
Doing this
take Vuforia for unity Import to Unity In the after , Locate the Vuforia On pre-set precast units provided .
There are the following prefabricated parts :ARCamera、CloudRecognition、CylinderTarget、FrameMarker、ImageTarget、Multitarget、ObjectTarget、TextRecognition、UserDefinedTarget、VirtualButton、Word.
We are here to ImageTarget Prefabrication as an example
stay Assets Add a C# Script (C# Script), named BtnControl, The script code is appended with .
Explain my script , I use this script by calling GUI.Button() Method , Draw buttons on the screen , After clicking the button , You can zoom in and out of the model , The script is rough . Forgive me .
Click on prefabricated parts ImageTarget, And then on the right side Inspector Click on Add Component
Enter script name :BtnControl( notes : When you type in , It should be automatically associated with this file ), Then return.
Then you can start dragging the precast units to Hierarchy Start using on . BtnControl.cs The script code is as follows
using UnityEngine;
using System.Collections;
public class BtnControl: MonoBehaviour {
void OnGUI() {
if (GUI.Button(new Rect(10, 50, 200, 50), " Zoom in "))
{
Vector3 v3 = transform.localScale;
transform.localScale = new Vector3(v3.x*1.2f, v3.y*1.2f, v3.z*1.2f);
}
if (GUI.Button(new Rect(10, 120, 200, 50), " narrow "))
{
Vector3 v3 = transform.localScale;
transform.localScale = new Vector3(v3.x/1.2f,v3.y/1.2f,v3.z/1.2f);
}
}
} 边栏推荐
- Brand renewal, product innovation, marketing innovation, Dongfeng Peugeot's upward road
- 网络安全等级测评和商用密码应用安全性评估是一回事吗?
- Why do SQL statements use indexes but still slow queries?
- I learned that automated testing is so popular after I got 2w+ in a month
- Blog recommended | bookkeeper - Apache pulsar high availability / strong consistency / low latency storage implementation
- Google搜索为什么不能无限分页?
- From outsourcing to self research and then to large factories, who knows how I came here in the past five years
- [VI. load balancing and related configurations]
- 公司新来的阿里P6被辞退了,因为写测试用例不规范,躺平的悲哀?
- Mysql+C# EF6间的连接
猜你喜欢

国货彩妆,败走618

How to write a test report approved by a large manufacturer? With these 30 sets of templates, I take off completely
MySQL 8.0.28 安装配置图文教程
redis实现队列的阻塞、延时、发布和订阅

Error 1062 in database, error reporting

细说腾讯如何做到直播延时降低90%以上方案

详解Seaborn,看这一篇就够了

ECCV 2020 | star: pedestrian trajectory prediction model based on transformer (II)

不要假装怀念Kindle

王兴张勇徐雷,谁能问鼎本地电商?
随机推荐
Geoffrey Hinton's latest interview: within five years, we will crack the brain's operating mechanism, but not through back propagation
Due to the suspension of Russian business: IBM Q1 lost 2billion, Cisco 1.3 billion, Adobe 500million, HP 6.7 billion, uipath 100million
[cloud native | kubernetes] in depth understanding of pod (VI)
InfoQ 极客传媒 15 周年庆征文|云原生时代微服务架构设计实践
Mysql+C# EF6间的连接
为UEditor for typecho 添加阅读更多按钮
MySQL数据库用户权限管理
Why can't Google search page infinite?
Brand renewal, product innovation, marketing innovation, Dongfeng Peugeot's upward road
Redis实现登录注册的示例代码
[paper] cascade rpn: delving into high quality region proposal network with adaptive revolution
After 4 years of experience, I have interviewed 20K test posts. I can't even master basic skills. It's better to recruit fresh students
王兴张勇徐雷,谁能问鼎本地电商?
Software testing career development direction, 6-year-old testing takes you out of confusion
A Baidu programmer was sentenced to: dissatisfied with others taking over the project, showing his own role, deleting and modifying the database for many times, and committing the crime of destroying
在大厂做了5年测试,5月被无情辞退,想给摸鱼的兄弟提个醒
不要假装怀念Kindle
Some tool functions commonly used in JS projects
鸿蒙 简易计算器实现案例教程
BAT和FAANG的时代翻篇儿了,谁来接棒?