Create an AR Game with RealityKit - Swift Tutorial
HTML-код
- Опубликовано: 27 мар 2020
- Learn how to use RealityKit to create a simple and fun augmented reality pairs game.
🎯 SWIFT UI COURSE - JUST $12.99 (valid until May 4th 2020) 🎯
www.udemy.com/course/build-ap...
➡️ Tutorial Files: / 35356572
👏 Support me on Patreon: / brianadvent
➡️ Web: www.brianadvent.com
✉️ COMMENTS ✉️
If you have questions about the video or Cocoa programming, please comment below. Хобби
Brian was the very first iOS instructor I found and followed on RUclips over 3.5 years ago. We built a login screen after creating the graphics in Sketch. That feeling I got the first time I saw it run on my iPhone was priceless! Just purchased the Udemy course, looks great!
Beautiful video Brian, keep up the great work!
Keep up the great videos! :D I’ll definitely have a go at making this app!
Would love an updated video where the cards flip back if they aren't the same until the player wins! Love the videos!!
Great video! I showed this video in class and it helped us so much, so thanks! Lots of support from Germany.
We have a question if you don't mind, do you know how we could use ar to automatically measure somebody's height? We would want to point the camera at a person and it to measure their height automatically, do you know how to do that by any chance?
Don't worry if you don't get around to answering this, you are probably very busy. Thank you very much anyway and continue with the great content!
And happy new year to you!
man....U r the best!
Thank u so much
Very cool. Thanks you!
Great thank you very much
Great video! Love the idea! One question as I am trying to tweak your code a little: If I want to resize the models one by one instead of all having the same scaling transform, how do I refer to each of them? I tried to use entity.name == "01" in your for loop that does the resizing but that does not work...
If it takes a while to load, know that it's because rendering images `loadAsync` for all 8 images on 16 tiles will be a large computation.
Hello Mr. Brain, thank you for this great tutorial, I have some question when I create more than one realty composer file in the same Xcode project. Xcode only saw one realty composer file, another one will be invisible by Xcode. so pls is there anyone could help
Hi Brian, how to I check if one card content is equal to another? (in order to add some rules and let my kids play!)
So this is a tutorial from Apple's WWDC 2019 Building Apps with RealityKit session. When you go further they recommend to store some custom properties and functions in to an own entity. So far so good but I am not able to cast the entity to my CustomEntity inside the onTap function. Can somebody help?
Hi,
does anyone know how to play the built-in animation which comes with the model?
Thanks in advance.
Great Video, everything was clear. Smale feedback, sometimes you're a bit to fast, so it's not always easy to watch along.
Damn it’s sooooo easy.
.sink(receiveCompletion: {error in print ("Error = \(error)") cancellable?.cancel() i got an error saying: Insert ';'
Im getting an error when i type "plane" ect at 4:08
Make sure your device is for 'Generic IOS Device'. I think that will solve the issue
totally new about this. i use windows and android. can it be done using those two
Nope
how to scale objects ??
Hi. I’m getting an error at 28:00 code: objects.append(entity.clone(recursive: true)). Actually two errors one saying must change to ModelEnitity and the second is something about the clone. Can anyone pls help.
Change
" objects: [ModelEntity] = []"
to
" objects: [Entity] = []"
I am getting the following errors on line 19, please help!
1. Extra argument 'minimumBounds' in call
2. Type 'AnchoringComponent.Target' has no member 'horizontal'
Hello, can you make sure you have "Any iOS Device (arm64)" selected and not one of the other simulators? That should fix your issue. You could also select a real device or a generic ios device.
@@revernos I truly hope you will still respond mate, I believe in you:
After changing to "Any iOS Device (arm64)", the errors disappear but I get the "A build only device cannot be used to run on this target. No supported iOS devices are available. Connect to a device to run your application or choose a simulated device as the destination." Do you by any chance know how to fix this?
@@Teemo022000 Hello! There could be several potential solutions for you.
Does running on an iPhone X (or any simulated device) give you any errors? If not, just use that simulated device.
Another potential simple solution could be to lower your deployment target (General -> Deployment Target), but that would only be okay if you can accept building for an less up-to-date version of iOS (if you’re planning to deploy the app you’re working on, then this isn’t a viable solution probably). This will only fix your issue if the problem is that your deployment is set to a more recent version of iOS than the device you are running the app on.
If you do not see any simulated devices, you may need to download some.
Here are some additional resources to help you troubleshoot:
- stackoverflow.com/questions/33747828/a-build-only-device-cannot-be-used-to-run-this-target
- ruclips.net/video/fmJdQKIQYqg/видео.html
Extra argument in AnchorEntity call
Thanks! I was getting the same error at 4:05 with AnchorEntity . appreciate the comment.
Amazing . Why not swift ui instead of storyboard?
Right now, I don’t see any advantages of using Swift UI in that particular case. You would have to use a UIViewRepresentable to integrate the ARView in Swift UI and some additional work with combine to pass through touch events which I find too complicated for the desired outcome.
Brian Advent ok. But I heard that swift ui is going to take the place of storyboard . Is that right?
Xcode is crashing on me after completing this app.
There's a little bug here where the object itself would flip if you tap on them.
Like individual parts of the airplane flipping like crazy.
We can workaround this by changing:
if let card = arView.entity(at: tapLocation) {
to
if let card = arView.entity(at: tapLocation), card.name.isEmpty {
(since all the models have name, but not the card)
This way the player can *only* flip by tapping the card.
(It gets really hard to flip the PotPlant tho 😁)
Anyway, nice tutorial. SceneKit will be dead soon.
Nice addition!
I find that all loaded entities names are empty, but can achieve it by assigning a name to the card.
(When creating the cards)
model.name = "gameCard"
cards.append(model)
To handle the larger objects it could be:
if let entity = arView.entity(at: tapLocation),
let card = entity.name == "gameCard" ? entity : entity.parent {
So tapping the object on top rotates the card rather than just the object.
Still a nice tutorial a year later!
Did anyone also have problems with: [Collision] Bad paramater (SphereRadius), value = 0.000000, passed to shape creation. ?
Where did you run into that? Do you have a line number? I did notice a problem when I first started following this video, I had to plug in my phone and select it as the build device. As I was typing the first line from the video I was getting an error: anchor = AnchorEntity(plane: .horizontal, minimumBounds: [0.2, 0.2]) . After I plugged in my phone that error went away and I was able to follow along with no trouble. My iPhone 7 is a little too old and slow to run this program with 4x4. I'm working on trying to make it 4x3.
Xcode is shit. I can not even get this app to build in the latest version. Freezes up on indexing.
Are you using a mac? because the Xcode is specifically made for apple use