{"id":400346,"date":"2024-06-29T15:12:38","date_gmt":"2024-06-29T15:12:38","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=400346"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=400346","title":{"rendered":"<span>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f TeleportArea \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e NavMesh<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044f \u043f\u043e\u0434 VR \u043d\u0430 Unity, \u0443 \u043c\u0435\u043d\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 TeleportArea, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0443\u044e.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ff7\/517\/c71\/ff7517c71876615393b7eb18ccd2e824.png\" alt=\"\u041f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0430\u044f TeleportArea\" title=\"\u041f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0430\u044f TeleportArea\" width=\"1353\" height=\"560\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ff7\/517\/c71\/ff7517c71876615393b7eb18ccd2e824.png\"\/><figcaption>\u041f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0430\u044f TeleportArea<\/figcaption><\/figure>\n<p>\u041d\u043e \u044d\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e, \u0435\u0441\u043b\u0438 \u043d\u0430 TeleportArea \u0441\u0442\u043e\u0438\u0442 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u0438\u0433\u0440\u043e\u043a \u043c\u043e\u0436\u0435\u0442 \u0432 \u043d\u0435\u043c \u0437\u0430\u0441\u0442\u0440\u044f\u0442\u044c.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6182b03babb378f6450d1a6a\" data-style=\"\" id=\"6182b03babb378f6450d1a6a\" width=\"\"><\/div>\n<p>\u042d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u0442\u0430\u043a, \u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0435\u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e(\u043d\u0443 \u043b\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u043c\u0435\u043d\u044f).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8aa\/812\/997\/8aa812997616a9a5491875d89b54e321.png\" alt=\"\u0420\u0435\u0448\u0435\u043d\u0438\u0435, \u043d\u043e \u0443 \u041d\u0430\u0441 \u0443\u0436\u0435 4 TeleportArea\" title=\"\u0420\u0435\u0448\u0435\u043d\u0438\u0435, \u043d\u043e \u0443 \u041d\u0430\u0441 \u0443\u0436\u0435 4 TeleportArea\" width=\"1349\" height=\"648\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8aa\/812\/997\/8aa812997616a9a5491875d89b54e321.png\"\/><figcaption>\u0420\u0435\u0448\u0435\u043d\u0438\u0435, \u043d\u043e \u0443 \u041d\u0430\u0441 \u0443\u0436\u0435 4 TeleportArea<\/figcaption><\/figure>\n<p>\u0412\u0440\u043e\u0434\u0435 \u0431\u044b, \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0440\u0435\u0448\u0435\u043d\u0430, \u043d\u043e<\/p>\n<ol>\n<li>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u043e\u0434\u043d\u043e\u0433\u043e TeleportArea, \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0438\u0445 \u0446\u0435\u043b\u044b\u0445 4<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u043a\u043e\u043c\u043d\u0430\u0442\u044b \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u0432<\/p>\n<\/li>\n<li>\n<p> \u042d\u0442\u043e \u043d\u0435 \u0433\u0430\u0434\u0438\u0442\u044c\u0441\u044f \u0434\u043b\u044f Terrain<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/df9\/f0e\/8c3\/df9f0e8c360b908a681538f2b662f3c3.png\" alt=\"\u041d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 Terain\" title=\"\u041d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 Terain\" width=\"685\" height=\"451\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/df9\/f0e\/8c3\/df9f0e8c360b908a681538f2b662f3c3.png\"\/><figcaption>\u041d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 Terain<\/figcaption><\/figure>\n<h2>\u0413\u043e\u0442\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0435\u0441\u0442\u044c, \u043d\u043e \u043e\u043d\u043e \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u0434\u043b\u044f SteamVr 1.x <a href=\"https:\/\/github.com\/Flafla2\/Vive-Teleporter\/\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/Flafla2\/Vive-Teleporter<\/a>, <\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6182d162edd610f626b80d16\" data-style=\"\" id=\"6182d162edd610f626b80d16\" width=\"\"><\/div>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b, \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u043a\u0443, \u0442.\u043a. \u043d\u0435 \u044f \u043e\u0434\u0438\u043d \u0441\u0442\u0440\u0430\u0434\u0430\u043b \u0441 \u043d\u0435\u044e!<\/p>\n<h2>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h2>\n<p>\u0412 Unity \u0435\u0441\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 NavMesh, \u043e\u043d \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u0430\u0440\u0442\u0443 \u043c\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f AI.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7dd\/7c3\/fc9\/7dd7c3fc974f45f2a31ecce14fcc9d52.png\" alt=\"\u0417\u0430\u043f\u0435\u0447\u0435\u043d\u043d\u044b\u0439 NavMesh\" title=\"\u0417\u0430\u043f\u0435\u0447\u0435\u043d\u043d\u044b\u0439 NavMesh\" width=\"1920\" height=\"567\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7dd\/7c3\/fc9\/7dd7c3fc974f45f2a31ecce14fcc9d52.png\"\/><figcaption>\u0417\u0430\u043f\u0435\u0447\u0435\u043d\u043d\u044b\u0439 NavMesh<\/figcaption><\/figure>\n<p>  \u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 TeleportArea. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u043d\u0430\u0431\u0440\u043e\u0441\u043e\u043a \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f NavMesh \u0432 Mesh.<\/p>\n<pre><code class=\"cs\">NavMeshTriangulation triangles = NavMesh.CalculateTriangulation(); Mesh mesh = new Mesh(); mesh.vertices = triangles.vertices; mesh.triangles = triangles.indices;<\/code><\/pre>\n<p>\u0417\u043d\u0430\u044f \u0447\u0442\u043e TeleportArea \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u043b\u044f \u0437\u043e\u043d\u044b \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f MeshRender \u0438 MeshFilter, \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u043f\u0430\u043f\u043a\u0443 \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439.<\/p>\n<pre><code>public static void SaveMesh(Mesh mesh, string name, bool makeNewInstance, bool optimizeMesh)     {         Mesh meshToSave = (makeNewInstance) ? Instantiate(mesh) : mesh;          if (optimizeMesh)             MeshUtility.Optimize(meshToSave);          AssetDatabase.CreateAsset(meshToSave, \"Assets\/GeneratedNavMeshes\/\" + name + \".asset\");         AssetDatabase.SaveAssets();     }<\/code><\/pre>\n<p>\u042f \u043e\u0444\u043e\u0440\u043c\u0438\u043b \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0432 \u0432\u0438\u0434\u0435 EditorWindow<\/p>\n<pre><code class=\"cs\">[CustomEditor(typeof(NaveMeshToMeshGenerator))] public class NavMeshToMeshEditor : Editor {     public override void OnInspectorGUI()     {         NaveMeshToMeshGenerator now = (NaveMeshToMeshGenerator) target;         GUILayout.Label(\"Created by LivelyPuer https:\/\/github.com\/LivelyPuer\");         now.BakeNaveMesh = GUILayout.Toggle(now.BakeNaveMesh, \"Bake NavMesh\", EditorStyles.toggle);         if (GUILayout.Button(\"GenerateMesh\"))         {             string curScene = EditorSceneManager.GetActiveScene().name;             if (now.BakeNaveMesh)             {                 NavMeshBuilder.BuildNavMesh();             }             NavMeshTriangulation triangles = NavMesh.CalculateTriangulation();             Mesh mesh = new Mesh();             mesh.vertices = triangles.vertices;             mesh.triangles = triangles.indices;             SaveMesh(mesh, \"Mesh\" + curScene, true, false);             MeshCollider now_Mesh = now.GetComponent&lt;MeshCollider>();             now_Mesh.sharedMesh = mesh;             MeshFilter nowMeshFilter = now.GetComponent&lt;MeshFilter>();             nowMeshFilter.mesh = mesh;             Debug.Log(\"TeleportArea was created\");         }     }     public static void SaveMesh(Mesh mesh, string name, bool makeNewInstance, bool optimizeMesh)     {         Mesh meshToSave = (makeNewInstance) ? Instantiate(mesh) : mesh;          if (optimizeMesh)             MeshUtility.Optimize(meshToSave);          AssetDatabase.CreateAsset(meshToSave, \"Assets\/GeneratedNavMeshes\/\" + name + \".asset\");         AssetDatabase.SaveAssets();     } }<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d25\/a74\/50a\/d25a7450accf112f971b208a4e9c8cd1.png\" width=\"567\" height=\"534\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d25\/a74\/50a\/d25a7450accf112f971b208a4e9c8cd1.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u041a\u0430\u043a \u044d\u0442\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f<\/h2>\n<ol>\n<li>\n<p>\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0440\u0435\u043b\u0438\u0437 \u0441 github  <a href=\"https:\/\/github.com\/LivelyPuer\/NavMeshToTeleportArea\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/LivelyPuer\/NavMeshToTeleportArea<\/a><\/p>\n<\/li>\n<li>\n<p>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 Unity, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0432 \u043f\u0430\u043a\u0435\u0442 SteamVR 2.x<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043c\u043d\u0430\u0442\u0443<\/p>\n<\/li>\n<\/ol>\n<figure class=\"bordered full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c01\/600\/917\/c016009175d4ac5847c36e52b5bdd183.png\" alt=\"\u041e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043d\u0430\u0442\u044b\" title=\"\u041e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043d\u0430\u0442\u044b\" width=\"1349\" height=\"555\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c01\/600\/917\/c016009175d4ac5847c36e52b5bdd183.png\"\/><figcaption>\u041e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043d\u0430\u0442\u044b<\/figcaption><\/figure>\n<p>   4. \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u0432\u0441\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b Collider \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0433\u0430\u043b\u043e\u0447\u043a\u0443 Static<\/p>\n<figure class=\"bordered full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e7d\/afd\/4c2\/e7dafd4c2710f706a9b452da2dd07ea7.png\" alt=\"Static\" title=\"Static\" width=\"1920\" height=\"560\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e7d\/afd\/4c2\/e7dafd4c2710f706a9b452da2dd07ea7.png\"\/><figcaption>Static<\/figcaption><\/figure>\n<p>   5. \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0435\u0444\u0430\u0431 \u0438\u0433\u0440\u043e\u043a\u0430 SteamVR \u043d\u0430 \u0441\u0446\u0435\u043d\u0443<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8d0\/ff0\/01f\/8d0ff001fc64b02ad02a0bdf83271ddb.png\" width=\"479\" height=\"270\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8d0\/ff0\/01f\/8d0ff001fc64b02ad02a0bdf83271ddb.png\"\/><figcaption><\/figcaption><\/figure>\n<p>   6. \u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0432 \u043e\u043a\u043d\u0435 Window\/NavMesh to Mesh<\/p>\n<p>   7. \u0412\u044b\u0431\u0440\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f TeleportArea<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ff0\/135\/a62\/ff0135a62edb7a9412d59df5aa7b4326.png\" width=\"264\" height=\"72\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ff0\/135\/a62\/ff0135a62edb7a9412d59df5aa7b4326.png\"\/><figcaption><\/figcaption><\/figure>\n<p>   8. \u041d\u0430\u0436\u0430\u0442\u044c \u0432 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0435\u043c\u0441\u044f \u043e\u043a\u043d\u0435 \u043a\u043d\u043e\u043f\u043a\u0443 &#171;Generate&#187;<\/p>\n<p>   9. \u041d\u0430 \u0441\u0446\u0435\u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f 2 \u043e\u0431\u044a\u0435\u043a\u0442\u0430:<\/p>\n<p>          1. Teleporting(\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f SteamVR)<\/p>\n<p>          2. \u041d\u0430\u0448\u0430 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f TeleportArea<\/p>\n<p>   10. \u0412\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u043e!<\/p>\n<p>\u041d\u0430\u0448 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6182ce411370783b8bf930f1\" data-style=\"\" id=\"6182ce411370783b8bf930f1\" width=\"\"><\/div>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u0441\u0442\u0430\u0442\u044c\u044e, \u0432\u0441\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<p><a href=\"https:\/\/github.com\/LivelyPuer\/NavMeshToTeleportArea\" rel=\"noopener noreferrer nofollow\"><strong>\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 github<\/strong><\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/588675\/\"> https:\/\/habr.com\/ru\/articles\/588675\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044f \u043f\u043e\u0434 VR \u043d\u0430 Unity, \u0443 \u043c\u0435\u043d\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 TeleportArea, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0443\u044e.<\/p>\n<figure class=\"full-width\"><figcaption>\u041f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0430\u044f TeleportArea<\/figcaption><\/figure>\n<p>\u041d\u043e \u044d\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e, \u0435\u0441\u043b\u0438 \u043d\u0430 TeleportArea \u0441\u0442\u043e\u0438\u0442 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u0438\u0433\u0440\u043e\u043a \u043c\u043e\u0436\u0435\u0442 \u0432 \u043d\u0435\u043c \u0437\u0430\u0441\u0442\u0440\u044f\u0442\u044c.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6182b03babb378f6450d1a6a\" data-style=\"\" id=\"6182b03babb378f6450d1a6a\" width=\"\"><\/div>\n<p>\u042d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u0442\u0430\u043a, \u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0435\u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e(\u043d\u0443 \u043b\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u043c\u0435\u043d\u044f).<\/p>\n<figure class=\"full-width\"><figcaption>\u0420\u0435\u0448\u0435\u043d\u0438\u0435, \u043d\u043e \u0443 \u041d\u0430\u0441 \u0443\u0436\u0435 4 TeleportArea<\/figcaption><\/figure>\n<p>\u0412\u0440\u043e\u0434\u0435 \u0431\u044b, \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0440\u0435\u0448\u0435\u043d\u0430, \u043d\u043e<\/p>\n<ol>\n<li>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u043e\u0434\u043d\u043e\u0433\u043e TeleportArea, \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0438\u0445 \u0446\u0435\u043b\u044b\u0445 4<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u043a\u043e\u043c\u043d\u0430\u0442\u044b \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u0432<\/p>\n<\/li>\n<li>\n<p> \u042d\u0442\u043e \u043d\u0435 \u0433\u0430\u0434\u0438\u0442\u044c\u0441\u044f \u0434\u043b\u044f Terrain<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><figcaption>\u041d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 Terain<\/figcaption><\/figure>\n<h2>\u0413\u043e\u0442\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0435\u0441\u0442\u044c, \u043d\u043e \u043e\u043d\u043e \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u0434\u043b\u044f SteamVr 1.x <a href=\"https:\/\/github.com\/Flafla2\/Vive-Teleporter\/\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/Flafla2\/Vive-Teleporter<\/a>, <\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6182d162edd610f626b80d16\" data-style=\"\" id=\"6182d162edd610f626b80d16\" width=\"\"><\/div>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b, \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u043a\u0443, \u0442.\u043a. \u043d\u0435 \u044f \u043e\u0434\u0438\u043d \u0441\u0442\u0440\u0430\u0434\u0430\u043b \u0441 \u043d\u0435\u044e!<\/p>\n<h2>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h2>\n<p>\u0412 Unity \u0435\u0441\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 NavMesh, \u043e\u043d \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u0430\u0440\u0442\u0443 \u043c\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f AI.<\/p>\n<figure class=\"full-width\"><figcaption>\u0417\u0430\u043f\u0435\u0447\u0435\u043d\u043d\u044b\u0439 NavMesh<\/figcaption><\/figure>\n<p>  \u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 TeleportArea. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u043d\u0430\u0431\u0440\u043e\u0441\u043e\u043a \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f NavMesh \u0432 Mesh.<\/p>\n<pre><code class=\"cs\">NavMeshTriangulation triangles = NavMesh.CalculateTriangulation(); Mesh mesh = new Mesh(); mesh.vertices = triangles.vertices; mesh.triangles = triangles.indices;<\/code><\/pre>\n<p>\u0417\u043d\u0430\u044f \u0447\u0442\u043e TeleportArea \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u043b\u044f \u0437\u043e\u043d\u044b \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f MeshRender \u0438 MeshFilter, \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u043f\u0430\u043f\u043a\u0443 \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439.<\/p>\n<pre><code>public static void SaveMesh(Mesh mesh, string name, bool makeNewInstance, bool optimizeMesh)     {         Mesh meshToSave = (makeNewInstance) ? Instantiate(mesh) : mesh;          if (optimizeMesh)             MeshUtility.Optimize(meshToSave);          AssetDatabase.CreateAsset(meshToSave, \"Assets\/GeneratedNavMeshes\/\" + name + \".asset\");         AssetDatabase.SaveAssets();     }<\/code><\/pre>\n<p>\u042f \u043e\u0444\u043e\u0440\u043c\u0438\u043b \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0432 \u0432\u0438\u0434\u0435 EditorWindow<\/p>\n<pre><code class=\"cs\">[CustomEditor(typeof(NaveMeshToMeshGenerator))] public class NavMeshToMeshEditor : Editor {     public override void OnInspectorGUI()     {         NaveMeshToMeshGenerator now = (NaveMeshToMeshGenerator) target;         GUILayout.Label(\"Created by LivelyPuer https:\/\/github.com\/LivelyPuer\");         now.BakeNaveMesh = GUILayout.Toggle(now.BakeNaveMesh, \"Bake NavMesh\", EditorStyles.toggle);         if (GUILayout.Button(\"GenerateMesh\"))         {             string curScene = EditorSceneManager.GetActiveScene().name;             if (now.BakeNaveMesh)             {                 NavMeshBuilder.BuildNavMesh();             }             NavMeshTriangulation triangles = NavMesh.CalculateTriangulation();             Mesh mesh = new Mesh();             mesh.vertices = triangles.vertices;             mesh.triangles = triangles.indices;             SaveMesh(mesh, \"Mesh\" + curScene, true, false);             MeshCollider now_Mesh = now.GetComponent&lt;MeshCollider>();             now_Mesh.sharedMesh = mesh;             MeshFilter nowMeshFilter = now.GetComponent&lt;MeshFilter>();             nowMeshFilter.mesh = mesh;             Debug.Log(\"TeleportArea was created\");         }     }     public static void SaveMesh(Mesh mesh, string name, bool makeNewInstance, bool optimizeMesh)     {         Mesh meshToSave = (makeNewInstance) ? Instantiate(mesh) : mesh;          if (optimizeMesh)             MeshUtility.Optimize(meshToSave);          AssetDatabase.CreateAsset(meshToSave, \"Assets\/GeneratedNavMeshes\/\" + name + \".asset\");         AssetDatabase.SaveAssets();     } }<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u041a\u0430\u043a \u044d\u0442\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f<\/h2>\n<ol>\n<li>\n<p>\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0440\u0435\u043b\u0438\u0437 \u0441 github  <a href=\"https:\/\/github.com\/LivelyPuer\/NavMeshToTeleportArea\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/LivelyPuer\/NavMeshToTeleportArea<\/a><\/p>\n<\/li>\n<li>\n<p>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 Unity, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0432 \u043f\u0430\u043a\u0435\u0442 SteamVR 2.x<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043c\u043d\u0430\u0442\u0443<\/p>\n<\/li>\n<\/ol>\n<figure class=\"bordered full-width\"><figcaption>\u041e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043d\u0430\u0442\u044b<\/figcaption><\/figure>\n<p>   4. \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u0432\u0441\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b Collider \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0433\u0430\u043b\u043e\u0447\u043a\u0443 Static<\/p>\n<figure class=\"bordered full-width\"><figcaption>Static<\/figcaption><\/figure>\n<p>   5. \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0435\u0444\u0430\u0431 \u0438\u0433\u0440\u043e\u043a\u0430 SteamVR \u043d\u0430 \u0441\u0446\u0435\u043d\u0443<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>   6. \u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0432 \u043e\u043a\u043d\u0435 Window\/NavMesh to Mesh<\/p>\n<p>   7. \u0412\u044b\u0431\u0440\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f TeleportArea<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>   8. \u041d\u0430\u0436\u0430\u0442\u044c \u0432 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0435\u043c\u0441\u044f \u043e\u043a\u043d\u0435 \u043a\u043d\u043e\u043f\u043a\u0443 &#171;Generate&#187;<\/p>\n<p>   9. \u041d\u0430 \u0441\u0446\u0435\u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f 2 \u043e\u0431\u044a\u0435\u043a\u0442\u0430:<\/p>\n<p>          1. Teleporting(\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f SteamVR)<\/p>\n<p>          2. \u041d\u0430\u0448\u0430 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f TeleportArea<\/p>\n<p>   10. \u0412\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u043e!<\/p>\n<p>\u041d\u0430\u0448 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6182ce411370783b8bf930f1\" data-style=\"\" id=\"6182ce411370783b8bf930f1\" width=\"\"><\/div>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u0441\u0442\u0430\u0442\u044c\u044e, \u0432\u0441\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<p><a href=\"https:\/\/github.com\/LivelyPuer\/NavMeshToTeleportArea\" rel=\"noopener noreferrer nofollow\"><strong>\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 github<\/strong><\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/588675\/\"> https:\/\/habr.com\/ru\/articles\/588675\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-400346","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/400346","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=400346"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/400346\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=400346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=400346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=400346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}