当前位置:网站首页>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 :

边栏推荐
- Unity skframework framework (XVIII), roamcameracontroller roaming perspective camera control script
- Js7day (event object, event flow, event capture and bubble, prevent event flow, event delegation, student information table cases)
- Modular commonjs es module
- 上手报告|今天聊聊腾讯目前在用的微服务架构
- Browser node event loop
- Day4 operator, self increasing, self decreasing, logical operator, bit operation, binary conversion decimal, ternary operator, package mechanism, document comment
- Unity skframework framework (XVI), package manager development kit Manager
- JSON serialization and parsing
- Counter attack of flour dregs: MySQL 66 questions, 20000 words + 50 pictures in detail! A little six
- Typora+docsify quick start
猜你喜欢

Variable, "+" sign, data type

Heap acwing 838 Heap sort

Apply lnk306gn-tl converter, non isolated power supply

上手报告|今天聊聊腾讯目前在用的微服务架构

3 a VTT terminal regulator ncp51200mntxg data

Day4 operator, self increasing, self decreasing, logical operator, bit operation, binary conversion decimal, ternary operator, package mechanism, document comment

leetcode621. 任务调度器

阿里发布的Redis开发文档,涵盖了所有的redis操作

3 A VTT端接 稳压器 NCP51200MNTXG资料

Linear DP acwing 899 Edit distance
随机推荐
About wechat enterprise payment to change x509certificate2 read certificate information, publish to the server can not access the solution
[opencv learning] [contour detection]
Hundreds of web page special effects can be used. Don't you come and have a look?
Jerry's watch time synchronization [chapter]
3 A VTT端接 稳压器 NCP51200MNTXG资料
Traverse entrylist method correctly
Linear DP acwing 895 Longest ascending subsequence
Counter attack of flour dregs: MySQL 66 questions, 20000 words + 50 pictures in detail! A little six
Modular commonjs es module
Unforgettable Ali, 4 skills, 5 hr additional written tests, it's really difficult and sad to walk
[opencv learning] [template matching]
[opencv learning] [image histogram and equalization]
Oracle from entry to mastery (4th Edition)
js2day(又是i++和++i,if语句,三元运算符,switch、while语句,for循环语句)
Unity skframework framework (XIV), extension extension function
Ltc3307ahv meets EMI standard, step-down converter qca7005-al33 phy
Efficiency comparison between ArrayList and LinkedList
Jerry's watch modifies the alarm clock [chapter]
Js6day (search, add and delete DOM nodes. Instantiation time, timestamp, timestamp cases, redrawing and reflow)
Unity SKFramework框架(十六)、Package Manager 开发工具包管理器