当前位置:网站首页>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:插值到目标角度所需的时间



边栏推荐
- Kotlin introductory notes (V) classes and objects, inheritance, constructors
- Solution to the problems of the 17th Zhejiang University City College Program Design Competition (synchronized competition)
- Multiple solutions to one problem, asp Net core application startup initialization n schemes [Part 1]
- 2311. Longest binary subsequence less than or equal to K
- 【ManageEngine】如何利用好OpManager的报表功能
- Svg optimization by svgo
- 迁移学习和域自适应
- Applet (global data sharing)
- Introduction Guide to stereo vision (3): Zhang calibration method of camera calibration [ultra detailed and worthy of collection]
- Introduction Guide to stereo vision (1): coordinate system and camera parameters
猜你喜欢

OpenGL - Coordinate Systems

信息与熵,你想知道的都在这里了
![Introduction Guide to stereo vision (4): DLT direct linear transformation of camera calibration [recommended collection]](/img/ed/0483c529db2af5b16b18e43713d1d8.jpg)
Introduction Guide to stereo vision (4): DLT direct linear transformation of camera calibration [recommended collection]

Progressive JPEG pictures and related

Confusion matrix
![一题多解,ASP.NET Core应用启动初始化的N种方案[上篇]](/img/c4/27ae0d259abc4e61286c1f4d90c06a.png)
一题多解,ASP.NET Core应用启动初始化的N种方案[上篇]

Svg optimization by svgo

一次 Keepalived 高可用的事故,让我重学了一遍它
![Rebuild my 3D world [open source] [serialization-1]](/img/74/b6253845b43bc18f425d57695fba7c.jpg)
Rebuild my 3D world [open source] [serialization-1]

Svgo v3.9.0+
随机推荐
My experience from technology to product manager
Codeforces Round #648 (Div. 2) E.Maximum Subsequence Value
Applet network data request
Composition of applet code
[technical school] spatial accuracy of binocular stereo vision system: accurate quantitative analysis
520 diamond Championship 7-4 7-7 solution
C # compare the differences between the two images
Information and entropy, all you want to know is here
一次 Keepalived 高可用的事故,让我重学了一遍它
Nodemon installation and use
Explain NN in pytorch in simple terms CrossEntropyLoss
[code practice] [stereo matching series] Classic ad census: (4) cross domain cost aggregation
C # image difference comparison: image subtraction (pointer method, high speed)
Kotlin introductory notes (IV) circular statements (simple explanation of while, for)
notepad++
【愚公系列】2022年7月 Go教学课程 003-IDE的安装和基本使用
C#图像差异对比:图像相减(指针法、高速)
深入浅出PyTorch中的nn.CrossEntropyLoss
太不好用了,长文章加图文,今后只写小短文
notepad++