How To Make An App Like Pokemon Go

@pierredrks Thanks so much :pray:t2::blush:

@pierredrks But when tap an annotation which is within the valid distance, such as 50 meters as in your sample code ,same fatal error appears again when calling the camera, and then App crashes before camera responds. Please help, thanks

@sunlite is it possible that you upload your project somewhere?

@pierredrks thanks, I solved the problem. Besides dae file, how can other 3D format files work for the AR_hunt, such as MAX. FBX. obj. mb ? I have tried to convert FBX. obj. mb files into dae file, but the converted dae files still failed to work.

@pierredrks I also tried other dae files from https://clara.io/library, such as : rabbit, princess-luna-season-1-high-resolution, test, Untitled Scene, piplup, Bear, Gato, Princess Twilight Sparkle, but none of those dae files worked for your Sample code!
Then I also tried other dae files from : https://3dwarehouse.sketchup.com/ , such as : tails, worm, writtle-tittle, lion-cub, but none of them works for your Sample code.

So shall I amend those dae files for them to wok for your Sample code?
Stuck here for a long time.
Please help.
thanks!

@sunlite I’m not sure but i think that there is just a problem with the scaling/positioning of the objects inside the dae file. Maybe it helps to compare the values for position/size/scale with one of the working objects like the wolf.

@pierredrks with those unsuccessful dae files, crash before calling camera with the same error as previous: [quote=“sunlite, post:21, topic:26673”]
fatal error: unexpectedly found nil while unwrapping an Optional value
[/quote]

thanks

@pierredrks shall I adjust the values for position/size/scale within a 3D tool or within iOS code?

thanks

You can see and change the values in Xcode when you open the dae file. But you can also do it in code.

@pierredrks are following codes the all parts that you use in your sample for adjusting dae files? Thanks

if target.itemDescription == “dragon” {
enemy?.position = SCNVector3(x: 0, y: -15, z: 0)
} else {
enemy?.position = SCNVector3(x: 0, y: 0, z: 0)
}

@pierredrks sorry, I am new to it. Which is the simplest way between your 2 methods? Preferably there is a web link to specify on how to do it. Thanks!

@sunlite yep this is the only place the dae file is adjusted.
The simplest way to compare the values is to open both files in Xcode and select the topmost part of the object.
Changing the values is both simple in code or in Xcode, but i think the most clean solution is to change it in the dae file. Otherwise you’ll have a lot of if-else statements in your code.

Just an FYI!

I could only get this to work one time. Got multiple errors such as ‘cannot get carrier
’ and much more. See prior posts Just updated the phone to the latest version, 10.3 and Xcode 8.3. Everything now works perfectly without errors. And I can run it multiple times without any errors!

Hope this helps anyone else that can’t get it to run.

Ron Cookson

@pierredrks Finally I can import other dae files.Sorry that I disturbed you so much before :relaxed:
How can I use dae and scn files together in your sample? thanks!

Hello. I just updated my phone to iOS 10.3.1 and Xcode to the latest version. Now when I run the final project and tap on a pin to enter camera mode, the program gets an exception error ‘fatal error: unexpectedly found nil while unrapping and optional value’. Error line looks to be in the map viewcontroller at line ‘self.present(viewcontroller ,animated:true, completion:nil’. Checked ARViewcontroller is the correct name. Anyone else getting this or can help?

Thanks

Ron cookson

Great tutorial! Much to learn here, so thanks for all the detail.

One minor problem - when I remove the third target, the red pin remains and selecting it does nothing. Is this a bug or a feature?

@ron_cookson maybe you make the same mistake with me. Try to make the “itemDescription” in MapViewController same with the “target.itemDescription” in ViewController’s setupTarget function. Try it!

[

Here is my error, please help me


This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]