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

边栏推荐
- 难忘阿里,4面技术5面HR附加笔试面,走的真艰难真心酸
- The coloring method determines the bipartite graph acwing 860 Chromatic judgement bipartite graph
- C modifier
- JSON serialization and parsing
- Oracle从入门到精通(第4版)
- [opencv] [image gradient]
- [opencv learning] [image filtering]
- 【云原生数据库】遇到慢SQL该怎么办(上)?
- Jerry's watch reads the alarm clock [chapter]
- Async/await asynchronous function
猜你喜欢

阿里初面被两道编程题给干掉,再次内推终上岸(已拿电子offer)

PR usage skills, how to use PR to watermark?
![Jerry's watch delete alarm clock [chapter]](/img/7f/d51b37872b4ce905a0a723a514b2dc.jpg)
Jerry's watch delete alarm clock [chapter]

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

模数转换器(ADC) ADE7913ARIZ 专为三相电能计量应用而设计

Analog to digital converter (ADC) ade7913ariz is specially designed for three-phase energy metering applications
![[opencv learning] [moving object detection]](/img/2e/9b437b7fe22f1d57334529eda68e37.jpg)
[opencv learning] [moving object detection]

How can attribute mapping of entity classes be without it?

Linear DP acwing 897 Longest common subsequence

Unity SKFramework框架(十五)、Singleton 单例
随机推荐
Unity skframework framework (XV), singleton singleton
Unity SKFramework框架(二十)、VFX Lab 特效库
The redis development document released by Alibaba covers all redis operations
[opencv learning] [image pyramid]
Linear DP acwing 902 Shortest editing distance
Jerry's watch modifies the alarm clock [chapter]
moon
spfa AcWing 851. SPFA finding the shortest path
Floyd AcWing 854. Floyd finds the shortest path
Fundamentals of face recognition (facenet)
[opencv] [image gradient]
移动式布局(流式布局)
Js5day (event monitoring, function assignment to variables, callback function, environment object this, select all, invert selection cases, tab column cases)
Js6day (search, add and delete DOM nodes. Instantiation time, timestamp, timestamp cases, redrawing and reflow)
JDBC prevent SQL injection problems and solutions [preparedstatement]
C operator
【云原生数据库】遇到慢SQL该怎么办(上)?
Unity SKFramework框架(十二)、Score 计分模块
[opencv learning] [common image convolution kernel]
嵌入式软件开发