123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using UnityEngine;
- using XRTool.Util;
- public class GetZeroPos : MonoBehaviour
- {
- public Transform arMap;
- void Start()
- {
- TimerMgr.Instance.CreateTimer(()=> {
- MeshFilter meshFilter = arMap.GetComponent<MeshFilter>();
- if (meshFilter != null)
- {
-
- Mesh mesh = meshFilter.mesh;
-
- Vector3[] vertices = mesh.vertices;
-
- Vector3 minPoint = vertices[0];
-
- for (int i = 1; i < vertices.Length; i++)
- {
- Vector3 vertex = vertices[i];
- minPoint.x = Mathf.Min(minPoint.x, vertex.x);
- minPoint.y = Mathf.Min(minPoint.y, vertex.y);
- minPoint.z = Mathf.Min(minPoint.z, vertex.z);
- }
-
- Debug.Log("Mesh的零点:" + minPoint);
- }
- else
- {
- Debug.LogError("未找到MeshFilter组件");
- }
- },1,-1);
- }
- }
|