{"id":3062,"date":"2023-06-07T21:17:48","date_gmt":"2023-06-08T01:17:48","guid":{"rendered":"https:\/\/michaelrowe01.com\/?p=3062"},"modified":"2023-06-08T09:28:05","modified_gmt":"2023-06-08T13:28:05","slug":"build-spatial-experiences-with-realitykit","status":"publish","type":"post","link":"https:\/\/michaelrowe01.com\/index.php\/blog\/build-spatial-experiences-with-realitykit\/","title":{"rendered":"Build spatial Experiences with RealityKit"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"660\" height=\"318\" data-attachment-id=\"3118\" data-permalink=\"https:\/\/michaelrowe01.com\/index.php\/blog\/build-spatial-experiences-with-realitykit\/attachment\/build-spatial-experiences\/\" data-orig-file=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/Build-spatial-experiences.png?fit=1792%2C862&amp;ssl=1\" data-orig-size=\"1792,862\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Build-spatial-experiences\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/Build-spatial-experiences.png?fit=660%2C318&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/Build-spatial-experiences-1024x493.png?resize=660%2C318&#038;ssl=1\" alt=\"\" class=\"wp-image-3118\" srcset=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/Build-spatial-experiences.png?resize=1024%2C493&amp;ssl=1 1024w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/Build-spatial-experiences.png?resize=300%2C144&amp;ssl=1 300w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/Build-spatial-experiences.png?resize=768%2C369&amp;ssl=1 768w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/Build-spatial-experiences.png?resize=1536%2C739&amp;ssl=1 1536w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/Build-spatial-experiences.png?w=1792&amp;ssl=1 1792w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/Build-spatial-experiences.png?w=1320&amp;ssl=1 1320w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/figure>\n\n\n\n<p>RealityKit was introduced in 2019.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"660\" height=\"362\" data-attachment-id=\"3120\" data-permalink=\"https:\/\/michaelrowe01.com\/index.php\/blog\/build-spatial-experiences-with-realitykit\/attachment\/realitykit-entities-components-systems\/\" data-orig-file=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/RealityKit-Entities-Components-Systems-.png?fit=1872%2C1026&amp;ssl=1\" data-orig-size=\"1872,1026\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"RealityKit-Entities-Components-Systems-\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/RealityKit-Entities-Components-Systems-.png?fit=660%2C362&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/RealityKit-Entities-Components-Systems-.png?resize=660%2C362&#038;ssl=1\" alt=\"\" class=\"wp-image-3120\" srcset=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/RealityKit-Entities-Components-Systems-.png?resize=1024%2C561&amp;ssl=1 1024w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/RealityKit-Entities-Components-Systems-.png?resize=300%2C164&amp;ssl=1 300w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/RealityKit-Entities-Components-Systems-.png?resize=768%2C421&amp;ssl=1 768w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/RealityKit-Entities-Components-Systems-.png?resize=1536%2C842&amp;ssl=1 1536w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/RealityKit-Entities-Components-Systems-.png?w=1872&amp;ssl=1 1872w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/RealityKit-Entities-Components-Systems-.png?w=1320&amp;ssl=1 1320w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/figure>\n\n\n\n<p>Will be going thru \u201cHello World\u201d sample to explain the concepts.&nbsp;<\/p>\n\n\n\n<p>RealityKit and SwiftUI<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>RealityKit let\u2019s you add 3D elements to your Windows and Views from SwiftUI<\/li>\n\n\n\n<li>By putting models in a separate window, using the new volumetric window &#8211; it will be a fully 3d object viewable from any angle.&nbsp; You can define a specific size, which will be consistent, (sized in meters).&nbsp; To create an immersive space, this is a scene type, not just a window View.&nbsp; You create with ImmersiveSpace(id:) { RealityView }. Not that Open Immersive Space is Asynchronous&nbsp;<\/li>\n\n\n\n<li>Sessions to watch &#8211; Meet SwiftUI for spatial computing \u2026 and \u2026 Take SwiftUI to the next dimension<\/li>\n\n\n\n<li>Go beyond the Windows with SwiftUI &#8211; takes you into the various types of spaces in more detail.<\/li>\n<\/ul>\n\n\n\n<p>Entities and Components<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Entities are a container object, it must have components to do \u201csomething\u201d, comments are things like models and transformers.&nbsp; (Really good description on this)<\/li>\n\n\n\n<li>Check out Explore Materials in Reality Composer Pro<\/li>\n\n\n\n<li>Transforms places things in a space. Properties are used for scale and motion.<\/li>\n\n\n\n<li>There are functions to convert between RealityKit and SwiftUI coordinate systems<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"660\" height=\"371\" data-attachment-id=\"3121\" data-permalink=\"https:\/\/michaelrowe01.com\/index.php\/blog\/build-spatial-experiences-with-realitykit\/attachment\/collision-hover-effect-particle-emitter-physics-body\/\" data-orig-file=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/Collision-Hover-effect-Particle-Emitter-Physics-Body-.png?fit=1920%2C1080&amp;ssl=1\" data-orig-size=\"1920,1080\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Collision-Hover-effect-Particle-Emitter-Physics-Body-\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/Collision-Hover-effect-Particle-Emitter-Physics-Body-.png?fit=660%2C371&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/Collision-Hover-effect-Particle-Emitter-Physics-Body-.png?resize=660%2C371&#038;ssl=1\" alt=\"\" class=\"wp-image-3121\" srcset=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/Collision-Hover-effect-Particle-Emitter-Physics-Body-.png?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/Collision-Hover-effect-Particle-Emitter-Physics-Body-.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/Collision-Hover-effect-Particle-Emitter-Physics-Body-.png?resize=768%2C432&amp;ssl=1 768w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/Collision-Hover-effect-Particle-Emitter-Physics-Body-.png?resize=1536%2C864&amp;ssl=1 1536w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/Collision-Hover-effect-Particle-Emitter-Physics-Body-.png?w=1920&amp;ssl=1 1920w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/Collision-Hover-effect-Particle-Emitter-Physics-Body-.png?w=1320&amp;ssl=1 1320w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You can create your own components<\/li>\n<\/ul>\n\n\n\n<p>RealityView<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This is a SwiftUI view to place entities in your app.&nbsp; You add entities to a content instance.<\/li>\n\n\n\n<li>You can connect sate to component properties so that you can express connection between SwiftUI state and the model\n<ul class=\"wp-block-list\">\n<li>These are observable so they only change when objects that they depend on change<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Convert function will change from entity space to swiftUI space.\n<ul class=\"wp-block-list\">\n<li>This is useful for scaling, etc.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>You can subscribe to RealityView events in SwiftUI via .subscribe(to:) to run code based on events.<\/li>\n\n\n\n<li>You can also attach SwiftUI views to entities&nbsp; &#8211; check out enhance your spatial computing app with RealityKit<\/li>\n<\/ul>\n\n\n\n<p>Input, Animation, and Audio<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You can add gestures to realityKit views, you must have input target and collision components.<\/li>\n\n\n\n<li>You can add these components via Reality Composer Pro<\/li>\n\n\n\n<li>USDZ files can reference other usd files<\/li>\n\n\n\n<li>Default shape for collision component is cube, you should match it as best you can to your object\u2019s shape.<\/li>\n\n\n\n<li>You can add a component (HoverEffectComponent) to make your app react to where you are looking.&nbsp; This is done outside of the apps process for privacy.<\/li>\n\n\n\n<li>Built in type of animations: From-To-By, Orbit, and Time Sampled<\/li>\n\n\n\n<li>RealityKit sounds are spatial by default.&nbsp; No additional reverb is added to ambient sources, channel is great for background music.<\/li>\n<\/ul>\n\n\n\n<p>Custom Systems<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You can combine existing functionality in different ways to create components or systems.<\/li>\n\n\n\n<li>Work with Reality Composer pro content in Xcode &#8211; tells you more about this<\/li>\n\n\n\n<li>Systems are code that act on entities and components \u2026. This allows your structure code that implements your apps behavior<\/li>\n\n\n\n<li>Registering a system in your app, makes it available across your app.<\/li>\n\n\n\n<li>You can filter the entities via a entity query so only those matching entities are impacted by the system.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>RealityKit was introduced in 2019. Will be going thru \u201cHello World\u201d sample to explain the concepts.&nbsp; RealityKit and SwiftUI Entities and Components RealityView Input, Animation, and Audio Custom Systems<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"hide_page_title":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[2,3],"tags":[108,528,680],"class_list":["post-3062","post","type-post","status-publish","format-standard","hentry","category-blog","category-personal-softwareandit","tag-day-3","tag-realitykit","tag-wwdc23"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2aMa8-No","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts\/3062","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/comments?post=3062"}],"version-history":[{"count":2,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts\/3062\/revisions"}],"predecessor-version":[{"id":3122,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts\/3062\/revisions\/3122"}],"wp:attachment":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/media?parent=3062"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/categories?post=3062"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/tags?post=3062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}