Make your first Apple Vision Pro app!

Поділитися
Вставка
  • Опубліковано 21 жов 2023
  • Hi everyone, today I'm going to show you how to make an simple game for the new Apple Vision Pro!
    You'll learn the fundamentals of visionOS, including:
    • visionOS
    • realityKit
    • swiftUI
    • gestures
    • image-based lighting and shadows
    Assets download: madebyyuma.gumroad.com/l/visi...
    Final source code download: madebyyuma.gumroad.com/l/visi...
    This is a fun tutorial, so I hope you like it!
    #visionpro #visionos #spatialcomputing
  • Наука та технологія

КОМЕНТАРІ • 86

  • @iTarek
    @iTarek 4 місяці тому +21

    Three months ago, you created this amazing video. You need to create more videos. This is the most useful video I've seen in the field of developing for VisionOS.

    • @AnyoneCanCode
      @AnyoneCanCode  4 місяці тому +5

      Thanks for your kind words, I’m super glad you find this tutorial useful!

  • @ton101_zh
    @ton101_zh 5 місяців тому +6

    please make more video like this! And especially for non-ever Swift people.

  • @rick75916
    @rick75916 4 місяці тому +3

    Thanks Yuma for sharing this great tutorial! I'm new to both swift and swiftUI, your tutorial addresses many aspects of creating a complete VR application for VisionOS. It is a great starting point for anyone new in this field. It is impressive that know all this stuff at your age!

  • @jermanoid
    @jermanoid 5 місяців тому

    Great job. Can't wait to watch more

  • @Darkienzo1
    @Darkienzo1 4 місяці тому

    Great tutorial man, new to visionOS here and your videos are easy to follow and very informative.

  • @danielrossy7453
    @danielrossy7453 7 місяців тому +3

    Great tutorial! Thank you so much! Please keep going with VisionOS, really helpful

    • @AnyoneCanCode
      @AnyoneCanCode  7 місяців тому +1

      Thanks for your kind words! I’ll try to make some follow up tutorials when I’m free from school and other projects 😅

  • @user-wi8kb7bs4b
    @user-wi8kb7bs4b 4 місяці тому

    This is awesome and so useful. Great job. Hope to see more!

  • @JestrStudios
    @JestrStudios 4 місяці тому

    Love to see a video now that the AVP is out where you show how to deploy to the headset :)

  • @175726
    @175726 5 місяців тому

    Great job, I subscribed and i'm looking forward to your next vision pro lesson. Keep up the great work.

    • @AnyoneCanCode
      @AnyoneCanCode  5 місяців тому

      Thanks for subscribing! I’m glad you liked the tutorial!

  • @BlaineL
    @BlaineL 6 місяців тому

    Hi! From the future here 😊
    Very nice clean presentation! Thank you for sharing. I just finished the Harvard CS50 python course and made a cribbage and dice (10,000) game for my final projects. I've made a few games for iOS and Unity, too.. but I'm really excited to make a ProVision 'Dice 10,000' game and your tutorial has inspired me to start working on it ! 👍

    • @AnyoneCanCode
      @AnyoneCanCode  5 місяців тому

      Thanks, I’m glad you found my tutorial helpful! Best of luck with your Vision Pro game!

  • @benyao788
    @benyao788 5 місяців тому +3

    vision os development is exciting!

  • @j0_ztex683
    @j0_ztex683 2 місяці тому

    Thanks Luffy !

  • @shirpurkar
    @shirpurkar 5 місяців тому

    Great tutorial, bro make an adavance level demo. Thanks for your efforts

  • @ibrews
    @ibrews 8 місяців тому +4

    great tutorial! I come from Unity and Unreal so this was a wonderful introduction to using Swift for Apple Vision Pro. For some reason my dice don't cast shadows though even though I have the HDR scene and code set up the same as you.

    • @AnyoneCanCode
      @AnyoneCanCode  8 місяців тому +1

      Hi! Adding the GroundingShadowComponent should be enough to add shadows to the dice. It could also be a bug since the VisionOS is still in a beta state, so restarting Xcode might help. Hope this helps!

    • @ibrews
      @ibrews 8 місяців тому

      @@AnyoneCanCode no dice (lol) so probably a bug. Thank you though!

  • @KaleidoKurt
    @KaleidoKurt 6 місяців тому +5

    Great tutorial, thanks for putting this together! Any plans to make a more in depth visionOS tutorial? That's something that I would pay for as a beginning in Swift.
    Also, I suggest slowing down a bit and walking through the concepts a bit more. I had to pause every few seconds because you were going so quickly :) otherwise great!

    • @AnyoneCanCode
      @AnyoneCanCode  5 місяців тому +2

      Thanks! I’ll see if I can put together another tutorial when I’m free.
      Thanks for your feedback as well! I’m trying to strike a balance between keeping the tutorials short and adding more detail, since I don’t want to bore anyone 😅 I’ll take this into consideration though!

  • @cooz6683
    @cooz6683 3 місяці тому

    please make more video like this!

  • @martodonn
    @martodonn 3 місяці тому

    I could really use your help creating a vr/augmented realty app for vision pro.

  • @175726
    @175726 5 місяців тому

    Thanks!

    • @AnyoneCanCode
      @AnyoneCanCode  5 місяців тому

      You’re welcome, and thanks for this! 😊

  • @stephanemaurel5516
    @stephanemaurel5516 2 дні тому

    Wonderfull !!!! Existing a way to have the dice interact with real environment (like fall from table, bounce on wall, …) ?

  • @mtheuma
    @mtheuma 5 місяців тому

    Thank you! This is the best tutorial I've seen on this topic yet. One question, one of Apple's tutorials recommends adding .usd models into a swift package so that they are optimised automatically at run time. Have you tried this? Does it change anything in the way you access and address the model?

    • @AnyoneCanCode
      @AnyoneCanCode  5 місяців тому +1

      Thanks! If you want to load the model from a swift package, you will need to add an import statement for your package. You can then load the entity using the .entity(named:) function, which will load your .usd model! I would suggest taking a look at Apple’s “Hello World” sample code, which should answer what you’re looking for. Hope this helps!

  • @nemesis0720
    @nemesis0720 5 місяців тому +1

    hi,
    can you help me how I can manipulate blend shapes of a usdz file?
    I would appreciate any advice

  • @truedesireelements2040
    @truedesireelements2040 5 місяців тому

    Thank you I truly hope to create my first app soon. I will search your videos to see if you have anything on Unity to Vision OS? I hope you do, as I like the way you teach... I appreciate you...

    • @AnyoneCanCode
      @AnyoneCanCode  5 місяців тому

      Thank you! I don’t have any Unity tutorials yet, but I’ll definitely consider it!

  • @johnpill1
    @johnpill1 5 місяців тому

    Exceptional tutorial! Get a quieter keyboard though! :D

  • @jessetilly3030
    @jessetilly3030 5 місяців тому

    Great video and thanks for the help getting started. Is it just me or does the dice hang around after you've closed the app? Is there a cleanup step missing from the app on its closure?

    • @AnyoneCanCode
      @AnyoneCanCode  5 місяців тому

      Thanks! I’m not aware of any cleanup steps for VisionOS apps because garbage collection should be handled automatically. It’s likely to be a bug in the simulator, but could also be something I missed!

  • @andreiavram4050
    @andreiavram4050 7 місяців тому

    Hello, what should I do If I want to rotate a component onDrag gesture instead of moving? (I need something like, when I drag left rotate to left and when I drag right rotate to right)
    I've tried this:
    .onChanged{ value in
    let speed: Float = 0.1
    var newAngle = value.entity.transform.rotation.angle + speed * Float((value.translation.width / abs(value.translation.width)))
    if (newAngle < 0){
    newAngle = 2 * Float(Double.pi) - newAngle
    }
    value.entity.transform = Transform(
    scale: value.entity.transform.scale,
    rotation: simd_quatf(angle: newAngle, axis: SIMD3(x: 0, y: 1, z: 0)),
    translation: value.entity.transform.translation
    )
    }
    But it does'nt work with negative angles

  • @lukelavery313
    @lukelavery313 5 місяців тому

    Good video. What minimum specs do you recommend for developing with the vision os simulator?

    • @AnyoneCanCode
      @AnyoneCanCode  5 місяців тому

      I’ve found the simulator works best on Apple Silicon Macs!

  • @xarain
    @xarain 8 місяців тому

    Thanks for sharing. Curious to know how does the actual "in-headset" experience look like?

    • @AnyoneCanCode
      @AnyoneCanCode  8 місяців тому

      When you wear the Vision Pro, you'll be able to use hand gestures and manipulate the 3D objects directly. For example you can pinch to pick up the dice!

    • @xarain
      @xarain 8 місяців тому

      @@AnyoneCanCode
      Understood but you have tried it yourself since I could only see from your emulator
      Another question what kind of rework is required to cross deploy this into a Meta Quest headset?
      👍

    • @AnyoneCanCode
      @AnyoneCanCode  8 місяців тому +2

      This tutorial is made specifically for Apple Vision Pro. If you want to deploy it to Meta as well, a game engine like Unity could be an option!

  • @SegmenationFault
    @SegmenationFault 7 місяців тому +1

    Great video! I was wondering what changes you made to the dice usdz file to make it movable. It seems that Reality Composer let you add behaviors that did this, but with the recent updates (i believe xcode 15.0 beta 8), reality composer is gone. Reality composer pro still exists but i cant find a way to add behaviors to an object on there.

    • @AnyoneCanCode
      @AnyoneCanCode  7 місяців тому

      Thanks! I didn’t do anything special to the usdz file to make it movable. You just have to make sure that you’re making the mesh object movable, since usdz files tend to add blank parent objects!
      For the dice, i had to add some extra code to get the usdz’s children to fetch the actual mesh. Hope this helps!

    • @SegmenationFault
      @SegmenationFault 7 місяців тому

      Yes that helps, thank you! I think my issue was that (.first) wasn’t working since my usdz object had multiple children in a different order. Just had to do dice.children[1].children.first instead
      My Object:
      ▿ 'Camera' : Entity, children: 1
      ⟐ Transform
      ⟐ SynchronizationComponent
      ▿ 'Camera' : PerspectiveCamera
      ⟐ PerspectiveCameraComponent
      ⟐ Transform
      ⟐ SynchronizationComponent
      ▿ 'Cube' : Entity, children: 1
      ⟐ Transform
      ⟐ SynchronizationComponent
      ▿ 'Cube_001' : ModelEntity
      ⟐ Transform
      ⟐ ModelComponent
      ⟐ SynchronizationComponent
      ▿ 'Light' : Entity, children: 1
      ⟐ Transform
      ⟐ SynchronizationComponent
      ▿ 'Light' : SpotLight
      ⟐ Transform
      ⟐ SynchronizationComponent
      ⟐ SpotLightComponent
      Dice used in the tutorial:
      ▿ '' : Entity, children: 1
      ⟐ Transform
      ⟐ SynchronizationComponent
      ▿ 'dice02' : Entity, children: 1
      ⟐ Transform
      ⟐ SynchronizationComponent
      ▿ 'Cube' : ModelEntity
      ⟐ Transform
      ⟐ ModelComponent
      ⟐ SynchronizationComponent
      @@AnyoneCanCode

    • @chompskiGG
      @chompskiGG 5 місяців тому

      @@SegmenationFault I don't know anything about usdz files. How would I find out the structure of my model like you did here? I also can't get physics to apply.

    • @SegmenationFault
      @SegmenationFault 4 місяці тому

      ​@@chompskiGG hey! You just have to print it, here's my code snippet:
      if let diceModel = try? await Entity(named: "cube2"),
      let dice = diceModel.children[1].children.first {
      print(dice)
      print(diceModel)
      //other code
      }
      which then prints
      ▿ 'Cube_001' : ModelEntity
      ⟐ Transform
      ⟐ ModelComponent
      ⟐ SynchronizationComponent
      for "dice" specifically , and
      ▿ '' : Entity, children: 3
      ⟐ Transform
      ⟐ SynchronizationComponent
      ▿ 'Camera' : Entity, children: 1
      ⟐ Transform
      ⟐ SynchronizationComponent
      ▿ 'Camera' : PerspectiveCamera
      ⟐ PerspectiveCameraComponent
      ⟐ Transform
      ⟐ SynchronizationComponent
      ▿ 'Cube' : Entity, children: 1
      ⟐ Transform
      ⟐ SynchronizationComponent
      ▿ 'Cube_001' : ModelEntity
      ⟐ Transform
      ⟐ ModelComponent
      ⟐ SynchronizationComponent
      ▿ 'Light' : Entity, children: 1
      ⟐ Transform
      ⟐ SynchronizationComponent
      ▿ 'Light' : SpotLight
      ⟐ SpotLightComponent
      ⟐ Transform
      ⟐ SynchronizationComponent
      for the original dice model. Hope that helps and let me know if you have more questions!

  • @aryamandarda7654
    @aryamandarda7654 5 місяців тому

    Great video! I did have a question. Around 24:50, when I drag the dice inwards so like vertically downwards, it falls through the floor and disappears completely. Any idea as to why this might be happening?

    • @AnyoneCanCode
      @AnyoneCanCode  5 місяців тому +1

      Thanks! That’s a great point. Since the dice can be dragged anywhere, it is possible to clip it through the ground. This may not be an issue on a physical device, since you can’t phase your hand through the ground 😅
      A quick fix would be to set a minimum y-value and prevent the dice’s position from going below that value. Hope this helps!

  • @user-gr2zy7li7f
    @user-gr2zy7li7f 4 місяці тому

    Pro Tip: once project is complete copy all code and paste in VS Code code pilot and have it explain the code line by line to gain deeper insights into concepts, code and frameworks.

    • @projectembers
      @projectembers 3 місяці тому

      hello, do you mean github copilot chat?

  • @184Simon
    @184Simon 5 місяців тому

    Amazing tutorial, I bought the code and material, and everything works fine on my Macbook. How can I run this app on my real Apple Vision Pro?

    • @AnyoneCanCode
      @AnyoneCanCode  5 місяців тому +1

      Thanks and congrats on getting a Vision Pro! You can connect Xcode to your Vision Pro over WiFi on the same network. If you open Remote Devices in your Vision Pro settings and go to Devices and Simulators on Xcode, you should be able to pair the device. After that, enable Developer Mode in your AVP’s settings, restart, then run the app from Xcode. Hope this helps!

  • @gonzalomenevichian2167
    @gonzalomenevichian2167 5 місяців тому

    Great, TY, is any app assistance to create code if we are not a deep programer like you?

    • @AnyoneCanCode
      @AnyoneCanCode  5 місяців тому

      Of course, there are LLMs like ChatGPT or Bard which can assist you with your code. However I strongly suggest that you don’t rely on them when learning how to code!

  • @andreiavram4050
    @andreiavram4050 7 місяців тому

    Hey, is it a method to scale/movve an attachment/3d object when I hovered it with the eyes? I tried with HoverEffect with lift but it only highlights the object for everything I tried.

    • @danielrossy7453
      @danielrossy7453 7 місяців тому

      Hey, there is no option to track eye movements in VisionOS due to security reasons

    • @AnyoneCanCode
      @AnyoneCanCode  7 місяців тому +1

      Hi! I can confirm that eye tracking on VisionOS isn’t available, exactly as what Daniel mentioned.

  • @stancartmankenny
    @stancartmankenny 6 місяців тому

    is it possible to just get direct access to the left-eye and right-eye screens, to port an app that is already vr-capable?

    • @AnyoneCanCode
      @AnyoneCanCode  5 місяців тому

      Hi! Are you trying to write directly to the screen? If so, I don’t believe that is possible at the moment. A hacky work-around may be to place head-locked content in front of the user and render your VR content onto there. Otherwise, you can always create an immersive space and add your VR content there! Hope this helps!

  • @aajn88
    @aajn88 5 місяців тому +2

    On minute 19:36, my dice doesn't fall. I've checked the code several times and seems identical. Not sure if anything has changed since the video. I've also restarted XCode and the simulator but no luck :( do you know what's the issue? Maybe someone else has had this issue?

    • @AnyoneCanCode
      @AnyoneCanCode  5 місяців тому

      Hi! This could be because you haven’t set the dice’s physics body to dynamic. Other than this, it is difficult to know what the issue is, so I would recommend making sure there’s no typos!

  • @chompskiGG
    @chompskiGG 5 місяців тому

    I am trying to make another app using some lessons from this video, but I've run into a problem. When I do the variables similar to your "diceData" the variables only change within their respective files. So if I change, for example, "rolledNumber" in the ImmersiveView it will only change there and the variable will be unchanged in the ContentView.
    I have "ImmersiveView(spaceData: SpaceData())" in the App file and "var spaceData: SpaceData" in both the ImmersiveView and ContentView. Is there any thing I can try or test to make this work?

    • @AnyoneCanCode
      @AnyoneCanCode  5 місяців тому

      When you write “ImmersiveView(spaceData: SpaceData())”, the brackets “()” after SpaceData will create a new instance of the data, which means that it won’t update the data across your files. You should reference your “spaceData” variable instead, which should solve the issue. Hope this helps!

    • @chompskiGG
      @chompskiGG 5 місяців тому

      @@AnyoneCanCode I actually got it working with an ObservableObject but thank you for the detailed response. Is there anyway to add walls or use the users house (ARKit?) so the objects don't roll forever?

  • @rickyyy2006
    @rickyyy2006 3 місяці тому

    Hi sir, just want to know if buying a Vision Pro is going to allow me to build and test Vision Pro applications?
    On Apple website, it says need a Vision Pro development kit. Thanks a lot

    • @AnyoneCanCode
      @AnyoneCanCode  3 місяці тому

      Hi! Any Vision Pro will work with testing your apps. I’d recommend using the regular Vision Pro since you can connect over WiFi!

  • @joetaveras5470
    @joetaveras5470 4 місяці тому

    I am able to load 3d files into the Simulator, but how do I make it such that I can then move those 3D entities around? My 3D files do not load with the white bar underneath like yours. Please advise!

    • @AnyoneCanCode
      @AnyoneCanCode  4 місяці тому

      Hi! This tutorial explains how you can make the object interactive and drag it around. Unlike windows, there won’t be a white bar below the object, but instead you can just click and drag on the object itself. Hope this helps!

  • @byktorvictor
    @byktorvictor 8 місяців тому +2

    Dang Homie!!!
    you went missing for a while

    • @AnyoneCanCode
      @AnyoneCanCode  8 місяців тому +1

      I’ve been busy with my other projects 😄

  • @christopherknowles
    @christopherknowles 5 місяців тому

    Nice hat.

  • @nikokatsantonis1664
    @nikokatsantonis1664 5 місяців тому

    Do you need to be granted an VisionOS devloper kit to actually create apps?

    • @AnyoneCanCode
      @AnyoneCanCode  5 місяців тому

      You don’t need to! You can use the simulator to test your app and then publish it. Of course, you can request to have your app reviewed on a physical Vision Pro, or apply to go to a developer lab (if you’re near one) to try it out yourself!

  • @ledezmalove63
    @ledezmalove63 5 місяців тому

    I have a idea really 2 different ideas that would have most likely similar coding for the app ... Could I pay you to make a app for me ?

  • @maksimkuznetsov9993
    @maksimkuznetsov9993 5 місяців тому

    Can I start to create on Windows system?

  • @ton101_zh
    @ton101_zh 5 місяців тому

    16:40 How you know those functions?

    • @AnyoneCanCode
      @AnyoneCanCode  5 місяців тому

      Apple’s documentation is a good resource to know what functions to use! Xcode also has autocomplete which gives you a good hint as to what to use.

  • @user-jn5eh7xs9k
    @user-jn5eh7xs9k 4 місяці тому

    Because this is marketed as a beginner tutorial, you need to slow down and explain each step and function more. I basically just copied your code, but I didn't understand what I was doing and I'm gonna have trouble recreating it.

    • @AnyoneCanCode
      @AnyoneCanCode  4 місяці тому

      This is a beginner tutorial for those who are new to VisionOS development, and there is some required basic knowledge of Swift. I’m trying to strike a balance between keeping the videos short and adding depth to the tutorial! I’ll keep this in mind if I create a more beginner-friendly video. Thanks!