{"id":344666,"date":"2023-01-30T09:01:30","date_gmt":"2023-01-30T09:01:30","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=344666"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=344666","title":{"rendered":"<span>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u0442\u0435 3D-\u0448\u0430\u0445\u043c\u0430\u0442\u043d\u0443\u044e \u0434\u043e\u0441\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e SwiftUI \u0438 RealityKit<\/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><strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 SwiftUI, RealityKit, ARKit \u0438 Multipeer<\/strong><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/44a\/eef\/f73\/44aeeff733ab18f2d22cd0967b36208b.webp\" alt=\"\" title=\"\" width=\"699\" height=\"493\"\/><figcaption><\/figcaption><\/figure>\n<p>\u042f \u043f\u0440\u043e\u0432\u0435\u043b \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u0433\u043e\u0434\u0430 (2022), \u0438\u0437\u0443\u0447\u0430\u044f SceneKit. \u041f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f \u0437\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u043f\u043e\u0447\u0442\u0438 \u0434\u0432\u0443\u043c\u044f \u0434\u044e\u0436\u0438\u043d\u0430\u043c\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443, \u0432\u044b \u043d\u0430\u0439\u0434\u0451\u0442\u0435 \u0437\u0434\u0435\u0441\u044c, \u043d\u0430 Medium. \u0418\u0437\u0443\u0447\u0438\u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 SceneKit, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 RealityKit\/ARKit \u0432 2023 \u0433\u043e\u0434\u0443.<\/p>\n<p>\u042f \u043d\u0435 \u0431\u044b\u043b \u0443\u0432\u0435\u0440\u0435\u043d, \u0441 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438 WWDC2022 \u043d\u0430 ARKit, \u0430 \u0437\u0430\u0442\u0435\u043c \u043d\u0430 RealityKit, \u043d\u0443 \u0438 \u2014 \u044d\u0442\u043e \u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u043b\u043e. \u042f \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0432\u043d\u0430\u0447\u0430\u043b\u0435, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u0430\u043c\u044b\u0439 \u0440\u0430\u043d\u043d\u0438\u0439 WWDC.<\/p>\n<p>\u042f \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0440\u043e\u043b\u0438\u043a \u201c<a href=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2019\/605\/\" rel=\"noopener noreferrer nofollow\">Building Apps with RealityKit<\/a>\u201d (\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e RealityKit) \u0441 WWDC2019. \u042d\u0442\u043e \u0431\u044b\u043b \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u0437\u0430\u0440\u0435\u043d\u0438\u044f, \u043d\u0443, \u043f\u043e\u0447\u0442\u0438. \u042f \u043d\u0435 \u043c\u043e\u0433 \u043d\u0435 \u0437\u0430\u0434\u0443\u043c\u0430\u0442\u044c\u0441\u044f \u043e \u0441\u0445\u043e\u0434\u0441\u0442\u0432\u0435 \u043c\u0435\u0436\u0434\u0443 SceneKit \u0438 RealityKit. RealityKit \u2014 \u044d\u0442\u043e SceneKit. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043e\u043d\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0435\u0433\u043e \u0441 \u043d\u0443\u043b\u044f, \u0438\u043c\u0435\u044f \u0432 \u0432\u0438\u0434\u0443 \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0441\u0442\u044c, \u043d\u043e \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043f\u043e\u0447\u0442\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e. \u041e\u043d\u0438 \u0445\u043e\u0442\u0435\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u043a \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u043b\u0430\u0432\u043d\u044b\u043c. \u0418 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0434\u0430\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 RealityKit \u0431\u0435\u0437 \u043a\u0430\u043c\u0435\u0440\u044b \u2014 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0432\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u043e \u0432 SceneKit. ARKit \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043d\u0435\u043e\u0442\u044a\u0435\u043c\u043b\u0435\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e RealityKit, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0438 \u043a\u0430\u043a \u0438\u043d\u044c \u0438 \u044f\u043d\u044c: \u043e\u0434\u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0434\u0440\u0443\u0433\u0438\u043c.<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u044e, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u0435\u0440\u0435\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0448\u0430\u0445\u043c\u0430\u0442\u043d\u0443\u044e \u043f\u0430\u0440\u0442\u0438\u044e, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u0432\u00a0<a href=\"https:\/\/betterprogramming.pub\/start-building-a-3d-chess-game-using-scenekit-and-swiftui-3d072b025db2\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f RealityKit\/ARKit, \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u0432\u0448\u0438\u0441\u044c \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0445 \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u0430\u0445: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0430 \u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u0433\u0440\u044b.<\/p>\n<h3>\u041f\u0440\u043e\u0442\u043e\u0442\u0438\u043f<\/h3>\n<p><strong>UIRepresentable<\/strong><\/p>\n<p>\u0418\u0442\u0430\u043a, \u044d\u0442\u043e \u043f\u043e\u0447\u0442\u0438 2023 \u0433\u043e\u0434, \u0438 \u043d\u0435\u0442 \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u043f\u0443\u0442\u0438 \u043d\u0430\u0437\u0430\u0434, \u043a\u0440\u043e\u043c\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f UIKit. \u041f\u043b\u0430\u043d \u0441\u0431\u043e\u0440\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0438\u043c \u0436\u0435, \u043a\u0430\u043a \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432 \u0442\u043e\u0439 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438 WWDC2019, \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>\u042f \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b \u043a\u043e\u0434 \u0438\u0437 \u0441\u0432\u043e\u0435\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e SceneKit \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0435\u0433\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u044b \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438. \u041c\u043e\u0439 UIRepresentable \u0431\u044b\u043b \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0441\u0435\u0431\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u0432\u0441\u0435\u0433\u043e \u0434\u0435\u0441\u044f\u0442\u044c \u0441\u0442\u0440\u043e\u043a \u0438\u043b\u0438 \u043e\u043a\u043e\u043b\u043e \u0442\u043e\u0433\u043e.<\/p>\n<pre><code class=\"swift\">struct CustomARView: UIViewRepresentable {     typealias UIViewType = ARView          var view:ARView     var options: [Any] = []          func makeUIView(context: Context) -> ARView {         view.session.delegate = context.coordinator         return view     }          func updateUIView(_ view: ARView, context: Context) {     }          func makeCoordinator() -> Coordinator {         Coordinator(self.view)     }      \/\/ coordinator  }<\/code><\/pre>\n<h3>\u041a\u043b\u0430\u0441\u0441 Coordinator<\/h3>\n<p>\u0421 \u043a\u043b\u0430\u0441\u0441\u043e\u043c Coordinator \u0432\u0441\u0451 \u0438\u043d\u0430\u0447\u0435 (\u0441\u0442\u043e\u043b\u044c \u0436\u0435 \u043a\u0440\u0430\u0442\u043a\u0438\u0439), \u0432\u043e\u0442 \u0441\u043a\u0435\u043b\u0435\u0442 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"swift\">class Coordinator: NSObject, ARSessionDelegate {         private let arView: ARView          init(_ view: ARView) {                          self.arView = view             super.init()                       }<\/code><\/pre>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043b\u0435\u0433\u043a\u043e. \u042f \u0438\u0433\u0440\u0430\u043b \u0432 WWDC2019 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u044d\u043a\u0440\u0430\u043d\u0435 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u043b \u043a\u043e\u0434 \u0432 Coordinator \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u043c. \u042f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f, \u0442\u0430\u043a \u0447\u0442\u043e \u043c\u043d\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u0432\u0441\u044f \u0434\u043e\u0441\u043a\u0430, \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c\u043e\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0442\u0443\u0434\u0430 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0443 \u0438 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0443 \u043c\u0435\u043d\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u043e\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0438 \u043a\u0430\u043a \u043c\u043e\u043d\u0441\u0442\u0440\u044b, \u043d\u043e \u044d\u0442\u043e \u043b\u0435\u0433\u043a\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c. \u042f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439: \u0441 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u043e\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u043b\u0438\u0447\u0430\u043b\u0430\u0441\u044c \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044f \u043e\u0436\u0438\u0434\u0430\u043b, \u0445\u043e\u0442\u044f, \u043a \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u043c\u0443 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u044e, \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f Apple \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0430 \u0435\u0451\u00a0<a href=\"https:\/\/developer.apple.com\/documentation\/realitykit\/manipulating-reality-composer-scenes-from-code\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>, \u0438 \u043e\u043d\u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u044b\u043b\u0430 \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0435\u0448\u0435\u043d\u0430.<\/p>\n<p>\u042d\u0442\u043e \u0431\u044b\u043b\u0430 \u043e\u0441\u043d\u043e\u0432\u0430. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u044f \u0434\u0430\u0436\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u0448\u0430\u0433 \u0432\u043f\u0435\u0440\u0435\u0434, \u0442\u0430\u043a \u043a\u0430\u043a \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b 3D \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0430, \u0442\u043e\u043b\u044c\u043a\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0434\u043b\u044f \u0438\u0445 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438. \u042f \u0434\u0435\u043b\u0430\u043b \u044d\u0442\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e, \u0438\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u043c\u043e\u0451 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0430\u043b\u043e. \u042f \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043b \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0<a href=\"https:\/\/stackoverflow.com\/questions\/62752649\/realitykit-asynchronous-model-loading-doesnt-work\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430<\/a>\u00a0\u043d\u0430 Stack Overflow. \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0437\u0434\u0435\u0441\u044c \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f Cancelable (\u043a\u043e\u0434 WWDC2019 \u0434\u0430\u0436\u0435 \u043d\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f).<\/p>\n<pre><code class=\"swift\">loading = Entity.loadModelAsync(named: assetName)     .sink(receiveCompletion: { completion in         if case let .failure(error) = completion {             print(\"Unable to load a model due to error \\(error)\")         }         self.loading?.cancel()              }, receiveValue: { [self] (entity: Entity) in         if let entity = entity as? ModelEntity {             let piecePlayer = entity             loading?.cancel()             print(\"Congrats! Model is successfully loaded!\")             piecePlayer.position = SIMD3(x: 0, y: 0, z: 0)             piecePlayer.setScale(SIMD3(0.01,0.01,0.01), relativeTo: piecePlayer)             piecePlayer.generateCollisionShapes(recursive: true)             piecePlayer.name = \"GCHKing\"             anchor.addChild(piecePlayer)         }     })<\/code><\/pre>\n<p>\u041c\u043d\u0435 \u0432\u0441\u0451 \u0435\u0449\u0451 \u043d\u0443\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u0434\u043e\u0441\u043a\u0430. \u0412 SceneKit \u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043b \u043e\u0434\u0438\u043d \u0438\u0437 \u043a\u0443\u0431\u043e\u0432, \u043d\u043e \u0441 RealityKit \u044d\u0442\u043e \u043d\u0435 \u0438\u043c\u0435\u043b\u043e \u0441\u043c\u044b\u0441\u043b\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0441\u0435\u0442\u043a\u0443 \u0441 \u044d\u0442\u0438\u043c \u043a\u043e\u0434\u043e\u043c. \u041a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0432\u0441\u0442\u0440\u043e\u0438\u043b \u0432 \u043f\u0430\u0440\u0443 \u0446\u0438\u043a\u043b\u043e\u0432 \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u0443\u044e \u0434\u043e\u0441\u043a\u0443.  <\/p>\n<pre><code class=\"swift\">let material = SimpleMaterial(color: .black, isMetallic: true) let plainMesh = MeshResource.generatePlane(width: 0.1, depth: 0.1) let entity = ModelEntity(mesh: plainMesh, materials: [material]) anchor.addChild(entity)<\/code><\/pre>\n<p>\u042f \u0431\u044b\u043b \u043d\u0430 \u043f\u043e\u043b\u043f\u0443\u0442\u0438 \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0438\u0433\u0440\u044b \u043d\u0430 WWDC2019, \u043d\u043e \u0432 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0435\u0449\u0451 \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u0433\u0432\u043e\u0437\u0434\u043a\u043e\u0439. \u041e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u2014 \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u044f \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043d\u0435 \u0438\u043c\u0435\u043b, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 ARKit, \u0438 \u043d\u0430\u0448\u0451\u043b \u0437\u0434\u0435\u0441\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u043a\u043e\u0434.  <\/p>\n<pre><code class=\"swift\">directionalLight.light.color = .white directionalLight.light.intensity = 500 directionalLight.light.isRealWorldProxy = true directionalLight.shadow?.maximumDistance = 1 directionalLight.shadow?.depthBias = 4.0 directionalLight.orientation = simd_quatf(angle: Float(0).degrees2radians(),                                            axis: [0,1,0])  let lightAnchor = AnchorEntity(world: [0,1,0]) lightAnchor.addChild(directionalLight) arView.scene.anchors.append(lightAnchor)<\/code><\/pre>\n<h3>\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u0433\u0440\u044b<\/h3>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u0434\u043e\u0448\u043b\u0438 \u043a \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438 WWDC2019, \u044f \u043d\u0430\u0447\u0430\u043b \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0443 \u043d\u0438\u0445 \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u043b\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0443. \u042f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u043e\u043d\u0438 \u0443\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0434\u043b\u044f \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\/\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. \u0425\u0443\u0436\u0435 \u0442\u043e\u0433\u043e, \u043c\u0435\u043d\u044f \u0441\u043c\u0443\u0442\u0438\u043b\u043e \u0443\u0436\u0430\u0441\u043d\u043e\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 ModelEntity \u0432 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u043c \u043a\u043e\u0434\u0435 (\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043e \u0432 \u043c\u043e\u0451\u043c \u043a\u043e\u0434\u0435). \u0412 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043e\u043d\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u044d\u0442\u043e \u201c\u043c\u043e\u0434\u0435\u043b\u044c\u044e\u201d. \u0418\u043c\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0<em>model.model<\/em>\u00a0\u2014 \u044d\u0442\u043e \u043d\u0435\u0445\u043e\u0440\u043e\u0448\u043e, Apple.<\/p>\n<p>\u0412\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u043c\u0438\u0440\u0443. \u0423 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0438\u0433\u0440\u043e\u043a\u0430 \u0432 \u0448\u0430\u0445\u043c\u0430\u0442\u044b, \u043e\u0434\u0438\u043d \u0438\u0433\u0440\u0430\u0435\u0442 \u0431\u0435\u043b\u044b\u043c\u0438, \u0430 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u0438\u043a \u0438\u0433\u0440\u0430\u0435\u0442 \u0447\u0435\u0440\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0434\u044f\u0442 \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u043e\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0446\u0432\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u043d\u0430\u0436\u0430\u043b\u0438, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e\u0442 \u043d\u0430\u0431\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043f\u044b\u0442\u0430\u0435\u0442\u0435\u0441\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c. \u042f \u0442\u0430\u043a\u0436\u0435 \u0445\u043e\u0442\u0435\u043b \u043f\u0440\u0438\u0434\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u043c \u0444\u0438\u0433\u0443\u0440\u0430\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u043c\u043e\u0433 \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0437\u0436\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u0443\u0434\u0438\u0442\u044c, \u043a\u0442\u043e \u0432\u044b\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442 \u0438\u043b\u0438 \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442 \u0432 \u0438\u0433\u0440\u0435.<\/p>\n<pre><code class=\"swift\">enum PieceColor: Codable {     case black     case white }  struct PieceComponent: Component, Codable {     var color: PieceColor     var value: Int }  class ChessEntity: Entity, HasModel, HasCollision, HasPhysics {     \/\/public var model: ModelEntity!     public var piece: PieceComponent {         get { return components[PieceComponent.self] ?? PieceComponent(color: .white, value: 0) }         set { components[PieceComponent.self] = newValue }     } }<\/code><\/pre>\n<p>\u042f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0448\u0430\u0445\u043c\u0430\u0442\u043d\u044b\u0445 \u0444\u0438\u0433\u0443\u0440, \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0430\u0434 \u043d\u0438\u043c\u0438. \u0412 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u0441\u043d\u043e\u0432\u0430 \u0445\u043e\u0442\u0435\u043b \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0436\u0438\u0437\u043d\u0435\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0439 \u043f\u0440\u043e\u0434\u0443\u043a\u0442.  <\/p>\n<pre><code class=\"swift\">extension ChessEntity {     func movePiece() {         print(\"name \\(self.name)\")         self.transform.translation -= SIMD3&lt;Float>(0,0,-0.1)     } }<\/code><\/pre>\n<p>\u041a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u0442\u0435 \u0441 \u0432\u0430\u0448\u0438\u043c\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430\u043c\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435\u043c\/\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c, \u043a\u043e\u0433\u0434\u0430 \u043a\u0442\u043e-\u0442\u043e \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442. \u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u0432 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432\u0441\u0435\u0433\u043e \u0438\u0437 \u0434\u0432\u0443\u0445 \u0441\u0442\u0440\u043e\u043a:  <\/p>\n<pre><code class=\"swift\">let piecePlayer = ChessEntity() piecePlayer.model = entity.model<\/code><\/pre>\n<p>\u0420\u0430\u0441\u0441\u0442\u0430\u0432\u0438\u0432 \u0432\u0430\u0436\u043d\u044b\u0435 \u0444\u0438\u0433\u0443\u0440\u044b \u043f\u043e \u043c\u0435\u0441\u0442\u0430\u043c, \u044f \u0431\u044b\u043b \u0433\u043e\u0442\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0448\u0430\u0445\u043c\u0430\u0442\u043d\u0443\u044e \u043f\u0430\u0440\u0442\u0438\u044e \u044d\u043a\u0448\u043d. \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043d\u0430 \u0442\u0430\u0440\u0435\u043b\u043a\u0435 \u0441 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438 WWDC2019, \u0431\u043e\u043b\u0435\u0435 \u0438\u043b\u0438 \u043c\u0435\u043d\u0435\u0435. \u041a\u043e\u0434, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u00a0<em>UITapgestureRecognizer<\/em>.  <\/p>\n<pre><code class=\"swift\">@objc func handleTap2(_ sender: UIGestureRecognizer? = nil) {     let tapLocation = sender?.location(in: arView)     if let piece = arView.entity(at: tapLocation!) as? ChessEntity {         piece.movePiece()     }      }<\/code><\/pre>\n<h3>\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0451 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435, \u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043b \u0434\u043e\u0441\u043a\u0443 \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u043d\u0430 \u043d\u0435\u0451 \u0441\u0432\u043e\u044e \u0448\u0430\u0445\u043c\u0430\u0442\u043d\u0443\u044e \u0444\u0438\u0433\u0443\u0440\u0443. \u042f \u0431\u044b\u043b \u0433\u043e\u0442\u043e\u0432 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0448\u0430\u0433\u0443.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/087\/24c\/c2f\/08724cc2ffbcb51bf90bdc6a3698cdf1.webp\" alt=\"\" title=\"\" width=\"699\" height=\"367\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u0411\u0443\u0434\u0443\u0449\u0435\u0435<\/h3>\n<p>\u0418 \u0432\u043e\u0442 \u043e\u043d \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c, \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f \u0448\u0430\u0445\u043c\u0430\u0442\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e RealityKit, \u043d\u043e \u0438 ARKit \u2014 \u043e\u043d\u0438 \u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043f\u043e\u0447\u0442\u0438 \u043d\u0435\u0440\u0430\u0437\u043b\u0443\u0447\u043d\u044b\u043c\u0438.<\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0449\u0451 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u2014 \u0432 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043e\u043d\u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044e\u0442 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439, \u044d\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 SceneKit \u0438 \u041e\u0411\u042f\u0417\u0410\u0422\u0415\u041b\u042c\u041d\u041e \u0434\u043b\u044f \u043c\u043e\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u042f \u0445\u043e\u0447\u0443 \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u044f \u0434\u0435\u043b\u0430\u043b \u0438 \u0432 \u044d\u0442\u043e\u0442, \u0438 \u0432 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437; \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u043d\u0435\u0441\u0442\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442 \u0432 \u0438\u0433\u0440\u0443.<\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u043e\u0438 \u043c\u044b\u0441\u043b\u0438 \u0432\u0435\u0440\u043d\u0443\u043b\u0438\u0441\u044c \u043a \u0442\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443, \u043a\u043e\u0433\u0434\u0430 \u044f \u043d\u0430\u0447\u0430\u043b \u044d\u0442\u043e \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u0435 \u0432 \u043c\u0430\u0440\u0442\u0435 2022 \u0433\u043e\u0434\u0430. \u0422\u043e\u0433\u0434\u0430 \u044f \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u043b, \u0447\u0442\u043e SceneKit \u043d\u0435 \u0443\u043c\u0435\u0440, \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u0434\u044b\u0445\u0430\u043b. \u041f\u043e\u043a\u0430 \u0440\u0430\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c, \u0432 \u043c\u043e\u0435\u0439 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u043d\u043e \u044f \u0443\u0434\u0438\u0432\u043b\u0451\u043d \u0441\u0445\u043e\u0434\u0441\u0442\u0432\u043e\u043c \u043c\u0435\u0436\u0434\u0443 RealityKit \u0438 SceneKit.<\/p>\n<p>\u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043f\u043e\u043a\u043e\u043f\u0430\u0432\u0448\u0438\u0441\u044c, \u044f \u043d\u0430\u0448\u0435\u043b \u043e\u0442\u043b\u0438\u0447\u043d\u0443\u044e\u00a0<a href=\"https:\/\/1984.dev\/Limitations-of-RealityKit-1-0\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u044e\u00a0<\/a>\u0422\u043e\u043d\u0438 \u041c\u043e\u0440\u0430\u043b\u0435\u0441\u0430 (Tony Morales), \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0449\u0443\u044e RealityKit \u0438 SceneKit, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u043d \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0434\u0432\u0430 \u0433\u043e\u0434\u0430 \u043d\u0430\u0437\u0430\u0434. \u042f \u0441\u0432\u044f\u0437\u0430\u043b\u0441\u044f \u0441 \u043d\u0438\u043c, \u0438 \u043e\u043d \u0441\u043a\u0430\u0437\u0430\u043b \u043c\u043d\u0435, \u0447\u0442\u043e \u201c\u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043c\u043e\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0431\u044b\u043b\u0438 \u0440\u0435\u0448\u0435\u043d\u044b\u201d. \u0422\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0438 \u0437\u0432\u0443\u0447\u0438\u0442 \u0442\u0430\u043a, \u0431\u0443\u0434\u0442\u043e RealityKit \u0437\u0430\u043c\u0435\u043d\u0438\u043b SceneKit. \u042f \u0434\u0430\u043c \u0432\u0430\u043c \u0437\u043d\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u044f \u043f\u0435\u0440\u0435\u0434\u0443\u043c\u0430\u044e \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0433\u043e\u0434\u0443, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0448\u0430\u043d\u0441 \u043f\u043e \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u0432\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0432 \u044d\u0442\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u043c\u0435\u043d\u044f \u043d\u0430 Medium, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u0432 \u043a\u0443\u0440\u0441\u0435 \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u044b.<\/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\/post\/713358\/\"> https:\/\/habr.com\/ru\/post\/713358\/<\/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><strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 SwiftUI, RealityKit, ARKit \u0438 Multipeer<\/strong><\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u042f \u043f\u0440\u043e\u0432\u0435\u043b \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u0433\u043e\u0434\u0430 (2022), \u0438\u0437\u0443\u0447\u0430\u044f SceneKit. \u041f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f \u0437\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u043f\u043e\u0447\u0442\u0438 \u0434\u0432\u0443\u043c\u044f \u0434\u044e\u0436\u0438\u043d\u0430\u043c\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443, \u0432\u044b \u043d\u0430\u0439\u0434\u0451\u0442\u0435 \u0437\u0434\u0435\u0441\u044c, \u043d\u0430 Medium. \u0418\u0437\u0443\u0447\u0438\u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 SceneKit, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 RealityKit\/ARKit \u0432 2023 \u0433\u043e\u0434\u0443.<\/p>\n<p>\u042f \u043d\u0435 \u0431\u044b\u043b \u0443\u0432\u0435\u0440\u0435\u043d, \u0441 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438 WWDC2022 \u043d\u0430 ARKit, \u0430 \u0437\u0430\u0442\u0435\u043c \u043d\u0430 RealityKit, \u043d\u0443 \u0438 \u2014 \u044d\u0442\u043e \u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u043b\u043e. \u042f \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0432\u043d\u0430\u0447\u0430\u043b\u0435, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u0430\u043c\u044b\u0439 \u0440\u0430\u043d\u043d\u0438\u0439 WWDC.<\/p>\n<p>\u042f \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0440\u043e\u043b\u0438\u043a \u201c<a href=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2019\/605\/\" rel=\"noopener noreferrer nofollow\">Building Apps with RealityKit<\/a>\u201d (\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e RealityKit) \u0441 WWDC2019. \u042d\u0442\u043e \u0431\u044b\u043b \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u0437\u0430\u0440\u0435\u043d\u0438\u044f, \u043d\u0443, \u043f\u043e\u0447\u0442\u0438. \u042f \u043d\u0435 \u043c\u043e\u0433 \u043d\u0435 \u0437\u0430\u0434\u0443\u043c\u0430\u0442\u044c\u0441\u044f \u043e \u0441\u0445\u043e\u0434\u0441\u0442\u0432\u0435 \u043c\u0435\u0436\u0434\u0443 SceneKit \u0438 RealityKit. RealityKit \u2014 \u044d\u0442\u043e SceneKit. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043e\u043d\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0435\u0433\u043e \u0441 \u043d\u0443\u043b\u044f, \u0438\u043c\u0435\u044f \u0432 \u0432\u0438\u0434\u0443 \u043c\u043d\u043e\u0433\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0441\u0442\u044c, \u043d\u043e \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043f\u043e\u0447\u0442\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e. \u041e\u043d\u0438 \u0445\u043e\u0442\u0435\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u043a \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u043b\u0430\u0432\u043d\u044b\u043c. \u0418 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0434\u0430\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 RealityKit \u0431\u0435\u0437 \u043a\u0430\u043c\u0435\u0440\u044b \u2014 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0432\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u043e \u0432 SceneKit. ARKit \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043d\u0435\u043e\u0442\u044a\u0435\u043c\u043b\u0435\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e RealityKit, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0438 \u043a\u0430\u043a \u0438\u043d\u044c \u0438 \u044f\u043d\u044c: \u043e\u0434\u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0434\u0440\u0443\u0433\u0438\u043c.<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u044e, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u0435\u0440\u0435\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0448\u0430\u0445\u043c\u0430\u0442\u043d\u0443\u044e \u043f\u0430\u0440\u0442\u0438\u044e, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u0432\u00a0<a href=\"https:\/\/betterprogramming.pub\/start-building-a-3d-chess-game-using-scenekit-and-swiftui-3d072b025db2\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f RealityKit\/ARKit, \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u0432\u0448\u0438\u0441\u044c \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0445 \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u0430\u0445: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0430 \u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u0433\u0440\u044b.<\/p>\n<h3>\u041f\u0440\u043e\u0442\u043e\u0442\u0438\u043f<\/h3>\n<p><strong>UIRepresentable<\/strong><\/p>\n<p>\u0418\u0442\u0430\u043a, \u044d\u0442\u043e \u043f\u043e\u0447\u0442\u0438 2023 \u0433\u043e\u0434, \u0438 \u043d\u0435\u0442 \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u043f\u0443\u0442\u0438 \u043d\u0430\u0437\u0430\u0434, \u043a\u0440\u043e\u043c\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f UIKit. \u041f\u043b\u0430\u043d \u0441\u0431\u043e\u0440\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0438\u043c \u0436\u0435, \u043a\u0430\u043a \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432 \u0442\u043e\u0439 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438 WWDC2019, \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>\u042f \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b \u043a\u043e\u0434 \u0438\u0437 \u0441\u0432\u043e\u0435\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e SceneKit \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0435\u0433\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u044b \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438. \u041c\u043e\u0439 UIRepresentable \u0431\u044b\u043b \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0441\u0435\u0431\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u0432\u0441\u0435\u0433\u043e \u0434\u0435\u0441\u044f\u0442\u044c \u0441\u0442\u0440\u043e\u043a \u0438\u043b\u0438 \u043e\u043a\u043e\u043b\u043e \u0442\u043e\u0433\u043e.<\/p>\n<pre><code class=\"swift\">struct CustomARView: UIViewRepresentable {     typealias UIViewType = ARView          var view:ARView     var options: [Any] = []          func makeUIView(context: Context) -> ARView {         view.session.delegate = context.coordinator         return view     }          func updateUIView(_ view: ARView, context: Context) {     }          func makeCoordinator() -> Coordinator {         Coordinator(self.view)     }      \/\/ coordinator  }<\/code><\/pre>\n<h3>\u041a\u043b\u0430\u0441\u0441 Coordinator<\/h3>\n<p>\u0421 \u043a\u043b\u0430\u0441\u0441\u043e\u043c Coordinator \u0432\u0441\u0451 \u0438\u043d\u0430\u0447\u0435 (\u0441\u0442\u043e\u043b\u044c \u0436\u0435 \u043a\u0440\u0430\u0442\u043a\u0438\u0439), \u0432\u043e\u0442 \u0441\u043a\u0435\u043b\u0435\u0442 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"swift\">class Coordinator: NSObject, ARSessionDelegate {         private let arView: ARView          init(_ view: ARView) {                          self.arView = view             super.init()                       }<\/code><\/pre>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043b\u0435\u0433\u043a\u043e. \u042f \u0438\u0433\u0440\u0430\u043b \u0432 WWDC2019 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u044d\u043a\u0440\u0430\u043d\u0435 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u043b \u043a\u043e\u0434 \u0432 Coordinator \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u043c. \u042f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f, \u0442\u0430\u043a \u0447\u0442\u043e \u043c\u043d\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u0432\u0441\u044f \u0434\u043e\u0441\u043a\u0430, \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c\u043e\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0442\u0443\u0434\u0430 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0443 \u0438 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0443 \u043c\u0435\u043d\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u043e\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0438 \u043a\u0430\u043a \u043c\u043e\u043d\u0441\u0442\u0440\u044b, \u043d\u043e \u044d\u0442\u043e \u043b\u0435\u0433\u043a\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c. \u042f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439: \u0441 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u043e\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u043b\u0438\u0447\u0430\u043b\u0430\u0441\u044c \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044f \u043e\u0436\u0438\u0434\u0430\u043b, \u0445\u043e\u0442\u044f, \u043a \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u043c\u0443 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u044e, \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f Apple \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0430 \u0435\u0451\u00a0<a href=\"https:\/\/developer.apple.com\/documentation\/realitykit\/manipulating-reality-composer-scenes-from-code\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>, \u0438 \u043e\u043d\u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u044b\u043b\u0430 \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0435\u0448\u0435\u043d\u0430.<\/p>\n<p>\u042d\u0442\u043e \u0431\u044b\u043b\u0430 \u043e\u0441\u043d\u043e\u0432\u0430. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u044f \u0434\u0430\u0436\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u0448\u0430\u0433 \u0432\u043f\u0435\u0440\u0435\u0434, \u0442\u0430\u043a \u043a\u0430\u043a \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b 3D \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0430, \u0442\u043e\u043b\u044c\u043a\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0434\u043b\u044f \u0438\u0445 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438. \u042f \u0434\u0435\u043b\u0430\u043b \u044d\u0442\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e, \u0438\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u043c\u043e\u0451 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0430\u043b\u043e. \u042f \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043b \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0<a href=\"https:\/\/stackoverflow.com\/questions\/62752649\/realitykit-asynchronous-model-loading-doesnt-work\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430<\/a>\u00a0\u043d\u0430 Stack Overflow. \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0437\u0434\u0435\u0441\u044c \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f Cancelable (\u043a\u043e\u0434 WWDC2019 \u0434\u0430\u0436\u0435 \u043d\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f).<\/p>\n<pre><code class=\"swift\">loading = Entity.loadModelAsync(named: assetName)     .sink(receiveCompletion: { completion in         if case let .failure(error) = completion {             print(\"Unable to load a model due to error \\(error)\")         }         self.loading?.cancel()              }, receiveValue: { [self] (entity: Entity) in         if let entity = entity as? ModelEntity {             let piecePlayer = entity             loading?.cancel()             print(\"Congrats! Model is successfully loaded!\")             piecePlayer.position = SIMD3(x: 0, y: 0, z: 0)             piecePlayer.setScale(SIMD3(0.01,0.01,0.01), relativeTo: piecePlayer)             piecePlayer.generateCollisionShapes(recursive: true)             piecePlayer.name = \"GCHKing\"             anchor.addChild(piecePlayer)         }     })<\/code><\/pre>\n<p>\u041c\u043d\u0435 \u0432\u0441\u0451 \u0435\u0449\u0451 \u043d\u0443\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u0434\u043e\u0441\u043a\u0430. \u0412 SceneKit \u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043b \u043e\u0434\u0438\u043d \u0438\u0437 \u043a\u0443\u0431\u043e\u0432, \u043d\u043e \u0441 RealityKit \u044d\u0442\u043e \u043d\u0435 \u0438\u043c\u0435\u043b\u043e \u0441\u043c\u044b\u0441\u043b\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0441\u0435\u0442\u043a\u0443 \u0441 \u044d\u0442\u0438\u043c \u043a\u043e\u0434\u043e\u043c. \u041a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0432\u0441\u0442\u0440\u043e\u0438\u043b \u0432 \u043f\u0430\u0440\u0443 \u0446\u0438\u043a\u043b\u043e\u0432 \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u0443\u044e \u0434\u043e\u0441\u043a\u0443.  <\/p>\n<pre><code class=\"swift\">let material = SimpleMaterial(color: .black, isMetallic: true) let plainMesh = MeshResource.generatePlane(width: 0.1, depth: 0.1) let entity = ModelEntity(mesh: plainMesh, materials: [material]) anchor.addChild(entity)<\/code><\/pre>\n<p>\u042f \u0431\u044b\u043b \u043d\u0430 \u043f\u043e\u043b\u043f\u0443\u0442\u0438 \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0438\u0433\u0440\u044b \u043d\u0430 WWDC2019, \u043d\u043e \u0432 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0435\u0449\u0451 \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u0433\u0432\u043e\u0437\u0434\u043a\u043e\u0439. \u041e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u2014 \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u044f \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043d\u0435 \u0438\u043c\u0435\u043b, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 ARKit, \u0438 \u043d\u0430\u0448\u0451\u043b \u0437\u0434\u0435\u0441\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u043a\u043e\u0434.  <\/p>\n<pre><code class=\"swift\">directionalLight.light.color = .white directionalLight.light.intensity = 500 directionalLight.light.isRealWorldProxy = true directionalLight.shadow?.maximumDistance = 1 directionalLight.shadow?.depthBias = 4.0 directionalLight.orientation = simd_quatf(angle: Float(0).degrees2radians(),                                            axis: [0,1,0])  let lightAnchor = AnchorEntity(world: [0,1,0]) lightAnchor.addChild(directionalLight) arView.scene.anchors.append(lightAnchor)<\/code><\/pre>\n<h3>\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u0433\u0440\u044b<\/h3>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u0434\u043e\u0448\u043b\u0438 \u043a \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438 WWDC2019, \u044f \u043d\u0430\u0447\u0430\u043b \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0443 \u043d\u0438\u0445 \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u043b\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0443. \u042f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u043e\u043d\u0438 \u0443\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0434\u043b\u044f \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\/\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. \u0425\u0443\u0436\u0435 \u0442\u043e\u0433\u043e, \u043c\u0435\u043d\u044f \u0441\u043c\u0443\u0442\u0438\u043b\u043e \u0443\u0436\u0430\u0441\u043d\u043e\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 ModelEntity \u0432 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u043c \u043a\u043e\u0434\u0435 (\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043e \u0432 \u043c\u043e\u0451\u043c \u043a\u043e\u0434\u0435). \u0412 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043e\u043d\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u044d\u0442\u043e \u201c\u043c\u043e\u0434\u0435\u043b\u044c\u044e\u201d. \u0418\u043c\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0<em>model.model<\/em>\u00a0\u2014 \u044d\u0442\u043e \u043d\u0435\u0445\u043e\u0440\u043e\u0448\u043e, Apple.<\/p>\n<p>\u0412\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u043c\u0438\u0440\u0443. \u0423 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0438\u0433\u0440\u043e\u043a\u0430 \u0432 \u0448\u0430\u0445\u043c\u0430\u0442\u044b, \u043e\u0434\u0438\u043d \u0438\u0433\u0440\u0430\u0435\u0442 \u0431\u0435\u043b\u044b\u043c\u0438, \u0430 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u0438\u043a \u0438\u0433\u0440\u0430\u0435\u0442 \u0447\u0435\u0440\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0434\u044f\u0442 \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u043e\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0446\u0432\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u043d\u0430\u0436\u0430\u043b\u0438, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e\u0442 \u043d\u0430\u0431\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043f\u044b\u0442\u0430\u0435\u0442\u0435\u0441\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c. \u042f \u0442\u0430\u043a\u0436\u0435 \u0445\u043e\u0442\u0435\u043b \u043f\u0440\u0438\u0434\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u043c \u0444\u0438\u0433\u0443\u0440\u0430\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u043c\u043e\u0433 \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0437\u0436\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u0443\u0434\u0438\u0442\u044c, \u043a\u0442\u043e \u0432\u044b\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442 \u0438\u043b\u0438 \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442 \u0432 \u0438\u0433\u0440\u0435.<\/p>\n<pre><code class=\"swift\">enum PieceColor: Codable {     case black     case white }  struct PieceComponent: Component, Codable {     var color: PieceColor     var value: Int }  class ChessEntity: Entity, HasModel, HasCollision, HasPhysics {     \/\/public var model: ModelEntity!     public var piece: PieceComponent {         get { return components[PieceComponent.self] ?? PieceComponent(color: .white, value: 0) }         set { components[PieceComponent.self] = newValue }     } }<\/code><\/pre>\n<p>\u042f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0448\u0430\u0445\u043c\u0430\u0442\u043d\u044b\u0445 \u0444\u0438\u0433\u0443\u0440, \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0430\u0434 \u043d\u0438\u043c\u0438. \u0412 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u0441\u043d\u043e\u0432\u0430 \u0445\u043e\u0442\u0435\u043b \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0436\u0438\u0437\u043d\u0435\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0439 \u043f\u0440\u043e\u0434\u0443\u043a\u0442.  <\/p>\n<pre><code class=\"swift\">extension ChessEntity {     func movePiece() {         print(\"name \\(self.name)\")         self.transform.translation -= SIMD3&lt;Float>(0,0,-0.1)     } }<\/code><\/pre>\n<p>\u041a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u0442\u0435 \u0441 \u0432\u0430\u0448\u0438\u043c\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430\u043c\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435\u043c\/\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c, \u043a\u043e\u0433\u0434\u0430 \u043a\u0442\u043e-\u0442\u043e \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442. \u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u0432 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432\u0441\u0435\u0433\u043e \u0438\u0437 \u0434\u0432\u0443\u0445 \u0441\u0442\u0440\u043e\u043a:  <\/p>\n<pre><code class=\"swift\">let piecePlayer = ChessEntity() piecePlayer.model = entity.model<\/code><\/pre>\n<p>\u0420\u0430\u0441\u0441\u0442\u0430\u0432\u0438\u0432 \u0432\u0430\u0436\u043d\u044b\u0435 \u0444\u0438\u0433\u0443\u0440\u044b \u043f\u043e \u043c\u0435\u0441\u0442\u0430\u043c, \u044f \u0431\u044b\u043b \u0433\u043e\u0442\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0448\u0430\u0445\u043c\u0430\u0442\u043d\u0443\u044e \u043f\u0430\u0440\u0442\u0438\u044e \u044d\u043a\u0448\u043d. \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043d\u0430 \u0442\u0430\u0440\u0435\u043b\u043a\u0435 \u0441 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438 WWDC2019, \u0431\u043e\u043b\u0435\u0435 \u0438\u043b\u0438 \u043c\u0435\u043d\u0435\u0435. \u041a\u043e\u0434, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u00a0<em>UITapgestureRecognizer<\/em>.  <\/p>\n<pre><code class=\"swift\">@objc func handleTap2(_ sender: UIGestureRecognizer? = nil) {     let tapLocation = sender?.location(in: arView)     if let piece = arView.entity(at: tapLocation!) as? ChessEntity {         piece.movePiece()     }      }<\/code><\/pre>\n<h3>\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0451 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435, \u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043b \u0434\u043e\u0441\u043a\u0443 \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u043d\u0430 \u043d\u0435\u0451 \u0441\u0432\u043e\u044e \u0448\u0430\u0445\u043c\u0430\u0442\u043d\u0443\u044e \u0444\u0438\u0433\u0443\u0440\u0443. \u042f \u0431\u044b\u043b \u0433\u043e\u0442\u043e\u0432 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0448\u0430\u0433\u0443.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h3>\u0411\u0443\u0434\u0443\u0449\u0435\u0435<\/h3>\n<p>\u0418 \u0432\u043e\u0442 \u043e\u043d \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c, \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f \u0448\u0430\u0445\u043c\u0430\u0442\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e RealityKit, \u043d\u043e \u0438 ARKit \u2014 \u043e\u043d\u0438 \u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043f\u043e\u0447\u0442\u0438 \u043d\u0435\u0440\u0430\u0437\u043b\u0443\u0447\u043d\u044b\u043c\u0438.<\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0449\u0451 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u2014 \u0432 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043e\u043d\u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044e\u0442 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439, \u044d\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 SceneKit \u0438 \u041e\u0411\u042f\u0417\u0410\u0422\u0415\u041b\u042c\u041d\u041e \u0434\u043b\u044f \u043c\u043e\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u042f \u0445\u043e\u0447\u0443 \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u044f \u0434\u0435\u043b\u0430\u043b \u0438 \u0432 \u044d\u0442\u043e\u0442, \u0438 \u0432 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437; \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u043d\u0435\u0441\u0442\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442 \u0432 \u0438\u0433\u0440\u0443.<\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u043e\u0438 \u043c\u044b\u0441\u043b\u0438 \u0432\u0435\u0440\u043d\u0443\u043b\u0438\u0441\u044c \u043a \u0442\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443, \u043a\u043e\u0433\u0434\u0430 \u044f \u043d\u0430\u0447\u0430\u043b \u044d\u0442\u043e \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u0435 \u0432 \u043c\u0430\u0440\u0442\u0435 2022 \u0433\u043e\u0434\u0430. \u0422\u043e\u0433\u0434\u0430 \u044f \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u043b, \u0447\u0442\u043e SceneKit \u043d\u0435 \u0443\u043c\u0435\u0440, \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u0434\u044b\u0445\u0430\u043b. \u041f\u043e\u043a\u0430 \u0440\u0430\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c, \u0432 \u043c\u043e\u0435\u0439 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u043d\u043e \u044f \u0443\u0434\u0438\u0432\u043b\u0451\u043d \u0441\u0445\u043e\u0434\u0441\u0442\u0432\u043e\u043c \u043c\u0435\u0436\u0434\u0443 RealityKit \u0438 SceneKit.<\/p>\n<p>\u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043f\u043e\u043a\u043e\u043f\u0430\u0432\u0448\u0438\u0441\u044c, \u044f \u043d\u0430\u0448\u0435\u043b \u043e\u0442\u043b\u0438\u0447\u043d\u0443\u044e\u00a0<a href=\"https:\/\/1984.dev\/Limitations-of-RealityKit-1-0\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u044e\u00a0<\/a>\u0422\u043e\u043d\u0438 \u041c\u043e\u0440\u0430\u043b\u0435\u0441\u0430 (Tony Morales), \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0449\u0443\u044e RealityKit \u0438 SceneKit, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u043d \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0434\u0432\u0430 \u0433\u043e\u0434\u0430 \u043d\u0430\u0437\u0430\u0434. \u042f \u0441\u0432\u044f\u0437\u0430\u043b\u0441\u044f \u0441 \u043d\u0438\u043c, \u0438 \u043e\u043d \u0441\u043a\u0430\u0437\u0430\u043b \u043c\u043d\u0435, \u0447\u0442\u043e \u201c\u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043c\u043e\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0431\u044b\u043b\u0438 \u0440\u0435\u0448\u0435\u043d\u044b\u201d. \u0422\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0438 \u0437\u0432\u0443\u0447\u0438\u0442 \u0442\u0430\u043a, \u0431\u0443\u0434\u0442\u043e RealityKit \u0437\u0430\u043c\u0435\u043d\u0438\u043b SceneKit. \u042f \u0434\u0430\u043c \u0432\u0430\u043c \u0437\u043d\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u044f \u043f\u0435\u0440\u0435\u0434\u0443\u043c\u0430\u044e \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0433\u043e\u0434\u0443, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0448\u0430\u043d\u0441 \u043f\u043e \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u0432\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0432 \u044d\u0442\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u043c\u0435\u043d\u044f \u043d\u0430 Medium, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u0432 \u043a\u0443\u0440\u0441\u0435 \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u044b.<\/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\/post\/713358\/\"> https:\/\/habr.com\/ru\/post\/713358\/<\/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-344666","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344666","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=344666"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344666\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=344666"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=344666"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=344666"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}