当前位置:网站首页>Unity skframework framework (XIX), POI points of interest / information points
Unity skframework framework (XIX), POI points of interest / information points
2022-07-02 13:07:00 【CoderZ1010】
Catalog
One 、 brief introduction
POI It can be understood as some meaningful points in the scene , For example, the station 、 The mall 、 The hospital 、 Monitoring, etc. , This function is usually used for digital twin projects , The main purpose is to compare the two-dimensional icon representing these points with the three-dimensional target position “ binding ”, The essence is to turn world coordinates into screen coordinates . As shown in the following example , We bind the icon of a monitoring point to the location of the model :
The tool has been uploaded to my framework SKFramework Development toolbox in , As shown in the figure .
The framework is already in Github Open source , Address :GitHub - 136512892/SKFramework: Unity SKFramework Development framework
Two 、 Instructions
1. 2D and 3D matching
adopt Match Function will POI The icon matches the 3D target , among flag The parameter represents the matching identifier , The system will put the same identifier RectTransform And GameObject Match .
/// <summary>
/// Match according to the identifier
/// </summary>
/// <param name="flag"> identifier </param>
/// <param name="rectTransform">RectTransform Components </param>
public void Match(string flag, RectTransform rectTransform);
/// <summary>
/// Match according to the identifier
/// </summary>
/// <param name="flag"> identifier </param>
/// <param name="target"> Three dimensional objects </param>
public void Match(string flag, GameObject target);
2. remove
adopt Delete Function to remove a POI spot , After removal, the calculation of world coordinates to screen coordinates will no longer be carried out .
/// <summary>
/// Remove according to the identifier
/// </summary>
/// <param name="flag"> identifier </param>
/// <returns> Remove successfully returned true Otherwise return to false</returns>
public bool Delete(string flag);
3.UI The resolution of the
The code defaults to UI The resolution used is 1920*1080, It needs to be changed according to the actual situation
4.Camera The camera
The conversion between world coordinates and screen coordinates is through Camera Class WorldToScreenPoint Functionally implemented , Therefore, the system needs a Camera The main camera , When the system initializes, it will first get the Tag The label is MainCamera The camera , If it doesn't exist, then pass FindObjectOfType Function to find the camera .
3、 ... and 、Example Example
using UnityEngine;
using SK.Framework;
public class Example : MonoBehaviour
{
[SerializeField] private RectTransform rt;
[SerializeField] private GameObject target;
private void Start()
{
POI.Match(" monitor 1", rt);
POI.Match(" monitor 1", target);
}
}
After operation, as shown in the figure :
边栏推荐
- Interval DP acwing 282 Stone merging
- Ruby: how to copy variables without pointing to the same object- Ruby: how can I copy a variable without pointing to the same object?
- Hash table acwing 841 String hash
- Js3day (array operation, JS bubble sort, function, debug window, scope and scope chain, anonymous function, object, Math object)
- Rust语言文档精简版(上)——cargo、输出、基础语法、数据类型、所有权、结构体、枚举和模式匹配
- Execute any method of any class through reflection
- [200 opencv routines] 100 Adaptive local noise reduction filter
- About wechat enterprise payment to change x509certificate2 read certificate information, publish to the server can not access the solution
- PR usage skills, how to use PR to watermark?
- 8 examples of using date commands
猜你喜欢
Domestic free data warehouse ETL dispatching automation operation and maintenance expert taskctl
JSON serialization and parsing
Unity SKFramework框架(十二)、Score 计分模块
自主可控三维云CAD:CrownCAD赋能企业创新设计
Ali on three sides, it's really difficult to successfully get the offer rated P7
Linear DP acwing 898 Number triangle
Hash table acwing 841 String hash
js2day(又是i++和++i,if语句,三元运算符,switch、while语句,for循环语句)
Js4day (DOM start: get DOM element content, modify element style, modify form element attributes, setinterval timer, carousel Map Case)
Js8day (rolling event (scroll family), offset family, client family, carousel map case (to be done))
随机推荐
Uniapp develops wechat applet Tencent map function and generates sig signature of location cloud
Unity SKFramework框架(十五)、Singleton 单例
Unity skframework framework (XIII), question module
【youcans 的图像处理学习课】总目录
正确遍历EntryList方法
Docsify deploy IIS
三面阿里,有惊无险成功拿到offer定级P7,只能说是真的难
(6) Web security | penetration test | network security encryption and decryption ciphertext related features, with super encryption and decryption software
国内首款、完全自主、基于云架构的三维CAD平台——CrownCAD(皇冠CAD)
Unity SKFramework框架(十六)、Package Manager 開發工具包管理器
Efficiency comparison between ArrayList and LinkedList
moon
Jerry's watch ringtone audition [article]
Word efficiency guide - word's own template
上海交大教授:何援军——包围盒(包容体/包围盒子)
Unity SKFramework框架(十六)、Package Manager 开发工具包管理器
Post order traversal sequence of 24 binary search tree of sword finger offer
Jerry's weather code table [chapter]
Unity SKFramework框架(二十一)、Texture Filter 贴图资源筛选工具
Hundreds of web page special effects can be used. Don't you come and have a look?