Unity -- 用EasyAR制作出AR红包
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
|
using UnityEngine;using System.Collections;using UnityEngine.UI;public class Move : MonoBehaviour { public GameObject par; // Use this for initialization void Start () { } // Update is called once per frame void Update () { transform.Translate (-transform.forward*2f*Time.deltaTime); if (transform.position.z < -8f) { Destroy (this.gameObject); } }} |
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
using UnityEngine;using System.Collections;public class CreateHong : MonoBehaviour { public Transform[] points; public GameObject[] hongbaos; private int index; // Use this for initialization void Start () { InvokeRepeating ("CreateHongbao",1f,1f); } // Update is called once per frame void Update () { } void CreateHongbao(){ int i = Random.Range (0, 10); if (i > 1) { index = 0; } else { index = 1; } GameObject go = GameObject.Instantiate (hongbaos [index], points [Random.Range (0, points.Length)].position + new Vector3 (Random.Range (-0.5f, 0.5f), 0, 0), Quaternion.identity) as GameObject; go.transform.Rotate (new Vector3 (270, 180, 0)); } } } |
|
1
2
3
4
5
6
7
8
9
|
void OnMouseDown() { if (gameObject.tag == "Hong") { Debug.Log ("ddd"); } else if(gameObject.tag=="HongBao") { CreateHong._instace.isCreate = false; GameObject go=GameObject.Instantiate (par,gameObject.transform.position,Quaternion.identity) as GameObject; Destroy (go,2f); } } |
<ignore_js_op>![]()
<ignore_js_op>![]()
|
1
2
3
4
|
void Awake() { _instace = this; } |
|
1
2
3
4
|
public void PlayScale() { daxiao.gameObject.SetActive (true); daxiao.PlayForward (); } |
|
01
02
03
04
05
06
07
08
09
10
|
void OnMouseDown() { if (gameObject.tag == "Hong") { Debug.Log ("ddd"); } else if(gameObject.tag=="HongBao") { CreateHong._instace.isCreate = false; GameObject go=GameObject.Instantiate (par,gameObject.transform.position,Quaternion.identity) as GameObject; Destroy (go,2f); CreateHong._instace.PlayScale (); } } |
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
using UnityEngine;using System.Collections;using UnityEngine.UI;public class Move : MonoBehaviour { public GameObject par; // Use this for initialization void Start () { } // Update is called once per frame void Update () { transform.Translate (-transform.forward*2f*Time.deltaTime); if (transform.position.z < -8f) { Destroy (this.gameObject); } } void OnMouseDown() { if (gameObject.tag == "Hong") { Debug.Log ("ddd"); } else if(gameObject.tag=="HongBao") { CreateHong._instace.isCreate = false; GameObject go=GameObject.Instantiate (par,gameObject.transform.position,Quaternion.identity) as GameObject; Destroy (go,2f); CreateHong._instace.PlayScale (); } }} |
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
using UnityEngine;using System.Collections;public class CreateHong : MonoBehaviour { public static CreateHong _instace; public Transform[] points; public GameObject[] hongbaos; private int index; public bool isCreate; public TweenScale daxiao; void Awake() { _instace = this; isCreate = true; } // Use this for initialization void Start () { InvokeRepeating ("CreateHongbao",1f,1f); } // Update is called once per frame void Update () { } void CreateHongbao(){ if (isCreate) { int i = Random.Range (0, 10); if (i > 1) { index = 0; } else { index = 1; } GameObject go = GameObject.Instantiate (hongbaos [index], points [Random.Range (0, points.Length)].position + new Vector3 (Random.Range (-0.5f, 0.5f), 0, 0), Quaternion.identity) as GameObject; go.transform.Rotate (new Vector3 (270, 180, 0)); } else { return; } } public void PlayScale() { daxiao.gameObject.SetActive (true); daxiao.PlayForward (); }} |
Unity -- 用EasyAR制作出AR红包的更多相关文章
- 支付宝AR红包引出Python中的PIL小试
这两天支付宝AR红包火了,周围的同学全在玩.可是我一直在想这个原理是什么?通过请教大神和思考,知道了它有两个限定条件:GPS地理位置和图片的识别.所以,只要我们有了这两个限定条件,就不难进行该红包的破 ...
- 说一说关于破解支付宝AR红包的事
当朋友圈的你们才开始分享支付宝AR红包的消息的时候,我已经对它动了一二三四次歪脑筋了,虽然事实证明并不是那么顺利,至今我也只在电脑前识别出5个不知道在哪里的红包,其中一个还因为定位信息不符开不了. 昨 ...
- EasyAR 开发实例---AR礼物(简单demo)
一个节日礼物效果 --显示模型 在本次的案例中,我使用的是unity5.6.3版本,EasyAR 为2.0.(用1.0的版本,在渲染那块有问题) [导入SDK]到EasyAR官网(http://www ...
- Unity -- 使用easyAR的基础教程
“三人行,必有我师焉”,抱着共同学习进步的态度,和大家一起交流下EasyAR的用法.有不足的地方,欢迎指出!大家都知道,今年的QQ,支付宝,都用到了AR的技术,扫描一张图片,就会出现虚拟模型,及其想要 ...
- Unity+高通Vuforia SDK——AR
一.AR概念: 增强现实(Augmented Reality,简称AR),是在虚拟现实的基础上发展起来的新技术,也被称之为混合现实.是通过计算机系统提供的信息增加用户对现实世界感知的技术,将虚拟的信息 ...
- unity发布ios高通AR的问题
1)缺少引用,无法找到vuforiaBehavior 原因:Windows下的工程,直接考到mac下,导致unity自带插件(2017)有问题 解决:首先在playerSettings-xrSetti ...
- GJM :Unity使用EasyAR实现脱卡功能
首先说下大致思路当卡片离开摄像头时间,ImageTarget-Image的SetActive (false),所以其子物体(model)也就不显示了,因此解决的办法就是在Target (false)时 ...
- Python + PIL 处理支付宝AR红包
思路比较简单:1.对图片进行锐化处理:2.设(r_h, g_h, b_h)为支付宝遮罩黑条的RGB值,以此为中心,查找半径为Diff_radius的范围内所有的色值: 3.对每一行符合步骤2的像素点个 ...
- 基于Unity的AR开发初探:第一个AR应用程序
记得2014年曾经写过一个Unity3D的游戏开发初探系列,收获了很多好评和鼓励,不过自那之后再也没有用过Unity,因为没有相关的需求让我能用到.目前公司有一个App开发的需求,想要融合一下AR到A ...
随机推荐
- centos7 bond 和 网桥配置
rhel7系统bond配置(更新版本):https://www.cnblogs.com/zhangjianghua/p/9119808.html Bonding的模式一共有7种: 1.mode=0(b ...
- Selenium WebDriver-操作下拉框内容
操作下拉框中的内容 #encoding=utf-8 import unittest import time import chardet from selenium import webdriver ...
- 大数据学习——scala数组
package com import scala.collection.mutable.ArrayBuffer /** * Created by Administrator on 2019/4/8. ...
- python学习--python 连接SQLServer数据库(两种方法)
1. python 学习.安装教程参照: http://www.runoob.com/python/python-tutorial.html 2. 集成开发环境 JetBrains PyCharm C ...
- [python学习篇][廖雪峰][1]高级特性 ---迭代
由于字符串也是可迭代对象,因此,也可以作用于for循环: >>> for ch in 'ABC': ... print ch ... A B C 所以,当我们使用for循环时,只要作 ...
- POJ 1240 Pre-Post-erous!
k叉树的前序和后续遍历,问一共有多少种这样的k叉树 这个就是树的同构,组合数就能解决 同样的题目在51nod也有的,我的另一篇博客 POJ 1240 Pre-Post-erous! We are al ...
- 【java基础 14】锁的粒度:ThreadLocal、volatile、Atomic和Synchronized
导读:题目中提到的几个关键字,分别是解决并发问题中,加锁所使用到的几个关键字,每个关键字代表的锁的粒度 不同,本篇博客,主要是从概念定义上,区分这几个关键字的应用场景.(PS:睡梦中,依稀记得有回面试 ...
- Use of @OneToMany or @ManyToMany targeting an unmapped class:hibernate映射错误
hibernate映射异常:Use of @OneToMany or @ManyToMany targeting an unmapped class 新建了PO以后,要把PO所在的目录加入到Hiber ...
- android.os.NetworkOnMainThreadException解决办法
代码改变世界 在发起Http请求的Activity里面的onCreate函数里面添加如下代码: StrictMode.setThreadPolicy(new StrictMode.ThreadPoli ...
- BZOJ3990 [SDOI2015]排序 【搜索】
题目 小A有一个1-2^N的排列A[1..2^N],他希望将A数组从小到大排序,小A可以执行的操作有N种,每种操作最多可以执行一次,对于所有的i(1<=i<=N),第i中操作为将序列从左到 ...