当前位置:网站首页>Unity SKFramework框架(二十三)、MiniMap 小地图工具
Unity SKFramework框架(二十三)、MiniMap 小地图工具
2022-07-05 09:20:00 【CoderZ1010】
目录
简介
MiniMap可以帮助我们快速实现小地图功能,该工具已经上传至我的开发框架SKFramework中的Package Manager开发工具包管理器中,如图所示,点击右下角Install按钮即可下载安装。


SKFramework框架开源地址:
https://github.com/136512892/SKFramework

实现原理
1.以场景中的z轴正方向为上、以x轴正方向为右;
2.以场景中的左下角和右上角为两个基准点,分别记录为leftBottom、rightTop;
3.将场景中目标物体的Transform记录为target3d;
4.将界面中代表目标物体的Icon图标的RectTransform记录为target2d;
5.将小地图的RectTransform组件记录为mapRt;
6.用小地图的长度除以场景的长度得到水平方向上的比例;
(mapRt.rect.width / (rightTop.position.x - leftBottom.position.x))
7.用小地图的宽度除以场景的宽度得到垂直方向上的比例;
(mapRt.rect.height / (rightTop.position.z - leftBottom.position.z))
8.计算三维目标物体距左下角基点的长度和宽度,记录为horizontal、vertical;
(horizontal = target3d.position.x - leftBottom.position.x)
(vertical = target3d.position.z - leftBottom.position.z)
9.计算小地图中Icon图标距离左下角的长度和宽度,记录为x、y;
(x = horizontal * 水平方向上的比例)
(y = vertical * 垂直方向上的比例)
10.Icon图标将锚点设置为左下角,设置其位置。
(target2d.anchoredPosition = new Vector(x, y))
使用说明

isEnableRot:Icon图标是否随三维目标的旋转而旋转
isEnableRotLerp:计算旋转值时是否使用插值运算
rotationLerpTime:插值到目标角度所需的时间



边栏推荐
- Android 隐私沙盒开发者预览版 3: 隐私安全和个性化体验全都要
- Node collaboration and publishing
- nodejs_ 01_ fs. readFile
- 编辑器-vi、vim的使用
- Applet data attribute method
- C#绘制带控制点的Bezier曲线,用于点阵图像及矢量图形
- 信息与熵,你想知道的都在这里了
- Kotlin introductory notes (VI) interface and function visibility modifiers
- Kotlin introductory notes (II) a brief introduction to kotlin functions
- Generate confrontation network
猜你喜欢
![[code practice] [stereo matching series] Classic ad census: (4) cross domain cost aggregation](/img/d8/7291a5b14160600ba73810e6dd1eb5.jpg)
[code practice] [stereo matching series] Classic ad census: (4) cross domain cost aggregation

Applet customization component

【阅读笔记】图对比学习 GNN+CL

Understanding rotation matrix R from the perspective of base transformation

C语言-从键盘输入数组二维数组a,将a中3×5矩阵中第3列的元素左移到第0列,第3列以后的每列元素行依次左移,原来左边的各列依次绕到右边

OpenGL - Model Loading

Add discount recharge and discount shadow ticket plug-ins to the resource realization applet

Nips2021 | new SOTA for node classification beyond graphcl, gnn+ comparative learning

Figure neural network + comparative learning, where to go next?

Generate confrontation network
随机推荐
Talking about the difference between unittest and pytest
信息與熵,你想知道的都在這裏了
[technical school] spatial accuracy of binocular stereo vision system: accurate quantitative analysis
【组队 PK 赛】本周任务已开启 | 答题挑战,夯实商品详情知识
【PyTorch Bug】RuntimeError: Boolean value of Tensor with more than one value is ambiguous
一次 Keepalived 高可用的事故,让我重学了一遍它
[ctfhub] Title cookie:hello guest only admin can get flag. (cookie spoofing, authentication, forgery)
Rebuild my 3D world [open source] [serialization-1]
c#比较两张图像的差异
Analysis of eventbus source code
Golang foundation -- map, array and slice store different types of data
Uni app implements global variables
Introduction Guide to stereo vision (6): level constraints and polar correction of fusiello method
Kotlin introductory notes (III) kotlin program logic control (if, when)
My life
LeetCode 556. 下一个更大元素 III
The research trend of map based comparative learning (gnn+cl) in the top paper
OpenGL - Coordinate Systems
我的一生.
Kotlin introductory notes (IV) circular statements (simple explanation of while, for)