Make your first Apple Vision Pro app!

Sdílet
Vložit
  • čas přidán 21. 10. 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
  • Věda a technologie

Komentáře • 85

  • @iTarek
    @iTarek Před 4 měsíci +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  Před 3 měsíci +5

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

  • @rick75916
    @rick75916 Před 4 měsíci +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!

  • @ton101_zh
    @ton101_zh Před 4 měsíci +6

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

  • @Darkienzo1
    @Darkienzo1 Před 3 měsíci

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

  • @danielrossy7453
    @danielrossy7453 Před 6 měsíci +3

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

    • @AnyoneCanCode
      @AnyoneCanCode  Před 6 měsíci +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 Před 3 měsíci

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

  • @jermanoid
    @jermanoid Před 5 měsíci

    Great job. Can't wait to watch more

  • @JestrStudios
    @JestrStudios Před 4 měsíci

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

  • @BlaineL
    @BlaineL Před 5 měsíci

    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  Před 5 měsíci

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

  • @benyao788
    @benyao788 Před 4 měsíci +3

    vision os development is exciting!

  • @175726
    @175726 Před 4 měsíci

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

    • @AnyoneCanCode
      @AnyoneCanCode  Před 4 měsíci

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

  • @ibrews
    @ibrews Před 7 měsíci +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  Před 7 měsíci +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 Před 7 měsíci

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

  • @KaleidoKurt
    @KaleidoKurt Před 5 měsíci +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  Před 5 měsíci +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!

  • @j0_ztex683
    @j0_ztex683 Před měsícem

    Thanks Luffy !

  • @nemesis0720
    @nemesis0720 Před 4 měsíci +1

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

  • @shirpurkar
    @shirpurkar Před 4 měsíci

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

  • @martodonn
    @martodonn Před 2 měsíci

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

  • @mtheuma
    @mtheuma Před 4 měsíci

    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  Před 4 měsíci +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!

  • @truedesireelements2040
    @truedesireelements2040 Před 4 měsíci

    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  Před 4 měsíci

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

  • @cooz6683
    @cooz6683 Před 2 měsíci

    please make more video like this!

  • @jessetilly3030
    @jessetilly3030 Před 4 měsíci

    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  Před 4 měsíci

      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 Před 6 měsíci

    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 Před 4 měsíci

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

    • @AnyoneCanCode
      @AnyoneCanCode  Před 4 měsíci

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

  • @175726
    @175726 Před 4 měsíci

    Thanks!

    • @AnyoneCanCode
      @AnyoneCanCode  Před 4 měsíci

      You’re welcome, and thanks for this! 😊

  • @SegmenationFault
    @SegmenationFault Před 6 měsíci +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  Před 6 měsíci

      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 Před 6 měsíci

      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 Před 4 měsíci

      @@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 Před 3 měsíci

      ​@@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 Před 4 měsíci

    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  Před 4 měsíci +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!

  • @xarain
    @xarain Před 8 měsíci

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

    • @AnyoneCanCode
      @AnyoneCanCode  Před 8 měsíci

      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 Před 8 měsíci

      @@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  Před 8 měsíci +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!

  • @184Simon
    @184Simon Před 4 měsíci

    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  Před 4 měsíci +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 Před 4 měsíci

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

    • @AnyoneCanCode
      @AnyoneCanCode  Před 4 měsíci

      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!

  • @joetaveras5470
    @joetaveras5470 Před 3 měsíci

    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  Před 3 měsíci

      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!

  • @andreiavram4050
    @andreiavram4050 Před 6 měsíci

    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 Před 6 měsíci

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

    • @AnyoneCanCode
      @AnyoneCanCode  Před 6 měsíci +1

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

  • @johnpill1
    @johnpill1 Před 5 měsíci

    Exceptional tutorial! Get a quieter keyboard though! :D

  • @rickyyy2006
    @rickyyy2006 Před 3 měsíci

    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  Před 2 měsíci

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

  • @aajn88
    @aajn88 Před 4 měsíci +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  Před 4 měsíci

      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!

  • @stancartmankenny
    @stancartmankenny Před 5 měsíci

    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  Před 5 měsíci

      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!

  • @chompskiGG
    @chompskiGG Před 4 měsíci

    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  Před 4 měsíci

      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 Před 4 měsíci

      @@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?

  • @nikokatsantonis1664
    @nikokatsantonis1664 Před 4 měsíci

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

    • @AnyoneCanCode
      @AnyoneCanCode  Před 4 měsíci

      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!

  • @user-gr2zy7li7f
    @user-gr2zy7li7f Před 4 měsíci

    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 Před 2 měsíci

      hello, do you mean github copilot chat?

  • @ledezmalove63
    @ledezmalove63 Před 4 měsíci

    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 Před 4 měsíci

    Can I start to create on Windows system?

  • @christopherknowles
    @christopherknowles Před 4 měsíci

    Nice hat.

  • @byktorvictor
    @byktorvictor Před 8 měsíci +2

    Dang Homie!!!
    you went missing for a while

    • @AnyoneCanCode
      @AnyoneCanCode  Před 7 měsíci +1

      I’ve been busy with my other projects 😄

  • @ton101_zh
    @ton101_zh Před 4 měsíci

    16:40 How you know those functions?

    • @AnyoneCanCode
      @AnyoneCanCode  Před 4 měsíci

      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 Před 3 měsíci

    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  Před 3 měsíci

      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!