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



边栏推荐
- 深入浅出PyTorch中的nn.CrossEntropyLoss
- Blue Bridge Cup provincial match simulation question 9 (MST)
- Attention is all you need
- c语言指针深入理解
- Wxss template syntax
- Blogger article navigation (classified, real-time update, permanent top)
- 驾驶证体检医院(114---2 挂对应的医院司机体检)
- Codeforces Round #648 (Div. 2) D. Solve The Maze
- c#比较两张图像的差异
- fs. Path module
猜你喜欢

Newton iterative method (solving nonlinear equations)

Information and entropy, all you want to know is here
![[code practice] [stereo matching series] Classic ad census: (6) multi step parallax optimization](/img/54/cb1373fbe7b21c5383580e8b638a2c.jpg)
[code practice] [stereo matching series] Classic ad census: (6) multi step parallax optimization

OpenGL - Model Loading

Hosting environment API

The research trend of map based comparative learning (gnn+cl) in the top paper
![[reading notes] Figure comparative learning gnn+cl](/img/44/2e13d63ef654663852cbccb342b838.png)
[reading notes] Figure comparative learning gnn+cl

项目实战 | Excel导出功能
![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]

My experience from technology to product manager
随机推荐
C # image difference comparison: image subtraction (pointer method, high speed)
优先级队列(堆)
[code practice] [stereo matching series] Classic ad census: (4) cross domain cost aggregation
Codeworks round 639 (Div. 2) cute new problem solution
notepad++
Shutter uses overlay to realize global pop-up
Wxss template syntax
OpenGL - Lighting
[code practice] [stereo matching series] Classic ad census: (5) scan line optimization
Blue Bridge Cup provincial match simulation question 9 (MST)
np.allclose
Introduction Guide to stereo vision (4): DLT direct linear transformation of camera calibration [recommended collection]
Codeforces Round #648 (Div. 2) D. Solve The Maze
notepad++
图神经网络+对比学习,下一步去哪?
Solution to the problem of the 10th Programming Competition (synchronized competition) of Harbin University of technology "Colin Minglun Cup"
VS Code问题:长行的长度可通过 “editor.maxTokenizationLineLength“ 进行配置
混淆矩阵(Confusion Matrix)
OpenGL - Lighting
Explain NN in pytorch in simple terms CrossEntropyLoss