AR Minigame (Snows falling in 360 photospheres)

Hi guys, so I am trying to make a simple AR game, I’ve been experimenting with AR Studio for the past day, and have a rough idea on how to use some of the tools provided. I have some questions regarding to what I am trying to make:

  1. I have a photosphere, is it possible for me to make items fall? (IE: Inside my 360 photosphere), I have a button and on tap of the button it activates a snow falling effect. (So snow will now start falling inside your 360 photosphere).

  2. Now a counter will appear and a timer will appear! And now you will need to catch as many snow as you can within 10seconds! (For the timer part I’ve followed the video instruction so I have a gist on how to do the 10seconds timer).

  3. Once the 10 seconds timer is over. The snowfalls will be deactivated and the button will re-appear. (Basically retriggering from step 1).

PS: Additional question:
Is it possible to make a static counter / button in your photosphere? IE: Since i’m counting points inside the photosphere, I’d like the text to always be on the top left side, even when I’m rotating around (It will remain at the top left side.

2nd Edit:
I’ve realized we just had to put the counter / button outside of the grouped folder. Or basically place it in the root level. And i’ll appear in a static position. A totally unrelated question now though. Does anyone know why the position of stuff in which I see in my zap works studio is totally different when it’s in preview? IE: My text has to be rotated 90 degree to be centered during preview. (But in my zap works, it’s upside down instead of centered)

I was wondering if something like this is do-able? Or had anyone tried something similar before?

So to your questions.

  1. yes you can make thinks fall in the photosphere. but you will have to code it or use timelines. there is no physics in ZapWorks like there is in Unity. I would make a 3d model that will fall then you can push it with a script.
  2. you can also just set it relative to z.screen.

Sound like it will be a cool game.

Steve

You may also want to implement a memory pool for your snow particles to make your experience faster. Having too many partcles constantly spawned and detroyed will slow it down. The easiest way to do it imo is to make a snow particle subsymbol and configure the animation for it to have. If you want to avoid coding, drag like 100 or something of them to your hierarchy and place them in the scene at random spots, but well distributed. Then you play their animation randomly with Math.random and Z.after. But I’d spawn and place those 100 snow particles and push them to the hierarchy via code.

1 Like

Awesome! Thanks, hoping it would be a finalized great game too. It’s my first time playing around with AR stuff. Btw, I’ve tried setting the text relative to z.screen (actually i’ve tested every single z-options, so like z-Right, z-Left etc) but seems like it still has to be rotated for it to look centered on my Zappar APP.

Sorry! didn’t want to double post:
@marks, thanks for your input as well! So what you recommend was to construct a symbol, and once someone clicks the button it uses the Z.Group push function to insert the node with their respective animation starting to play right? (The animation will just be a simple rotation until it falls to the ground actually). I’ll definitely look into this method first! dragging 100 of them into my hierarchy seems like it’s going to take a toll at the performance since I’d like people even with lower-tier phones to enjoy my game.

The idea is to create a subsymbol with a single particle and its animation. Then, you insert these subsymbols to the hierarchy, either manually or through code. The amount is up to you. So you can drag 100 subsymbols to the hierarchy or push 100 subsymbols to the hierarchy with code for example. If you do it with code, you will also need to position them with code. Then, you play those subsymbols at random times and you will get the particles effect you are looking for.

Start small, if you manage to do it with 2 particles, you will be able to do it with any number you want.

1 Like

Hi @marks,

Thanks again for the pointer!
So for my current testing phase, I have a photosphere, and an empty group called Cookies, as well as a subsymbol created called cookies.

  1. The subsymbol uses state and controllers as well as timeline to imitate the cookies falling from top to bottom and rotating whilst dropping.

  2. I used the Z.push function to push my subsymbols (concept is taken off the particle topic) I found somewhere on in forum. So I’ve set a limit of 10 cookies, and used a simple for loop to generate my cookies. (I’ve logged the console, it basically generates the 10 cookies, but it’s all within each other) this is because I did not set a unique position for each of them (Still don’t know how but will continue experimenting on this).

  3. I’ve realized my ‘cookies’ folder which is supposed to contain my subsymbols which are pushed (spawned) does not appear in my photosphere. If I put the folder inside my photosphere, it simply do not appear, but if the folder is outside of the photosphere hierarchy (at the root level). It’ll show, but that isn’t what I’m trying to create since this won’t have the 360 degree effect.

Attached is my ZPP file (if you would be kind enough to take a look). Please do point out whichever part which I had implemented wrongly as well. All this is extremely new and confusing to me and I’m trying my best to figure everything out.

Restaurant-falling.zpp (5.1 MB)

1 Like

@ItsJW,
I was playing with your code. This may help you out a bit.

Some things to remember about a photosphere are:

  1. If you have something at a position of 0,0,0 you will not see it. Your to close to the camera.
  2. If you are using a 2d image, you can only see it when it’s facing the camera. So you will have to rotate it as it goes around the photosphere. (Ex. rotation 0,0,0 for front, rotation 0,90,0 for left, rotation 0,180,0 for back, rotation 0,270,0 for right)

Restaurant-falling-Help.zpp (5.9 MB)

Steve

Thank you so much Steve! Is my implementation of SubSymbols correct and feasible? It’s my first time scripting and using subsymbols (Not that I’ve used the other stuff frequently) but im just extremely paranoid and I might’ve messed up somewhere in my implementation. I’ll definitely take a look at what you’ve changed in the .ZPP thank you!

It looks good to me.

Steve

1 Like

Hey steve, I’ve actually realized what you said regarding 2D models, so I’ve used a 3D one for testing instead. But I realized, once I switched to 3D with the same code, the same thing happens (The item disappears) inside the hierarchy, but once placed outside it appears… (PS: can I scale the 3D item inside the subsymbol)? Or do I have to scale the empty group containing the subsymbol?

Attached is another .ZPP file for your reference. Sorry for troubling you but I’m so lost like how is the same thing not working. Once switched to 3D. Steve.zpp (21.7 MB)

–I FINALLY GOT IT TO WORK–

I think it had something to do with my 3D model, I used a random one from sketchfab, and used the same implementation you taught me, everything is working as expected. Will further update you on this. Once my game is out I’ll make sure you’ll be the first to know about it! And I’ll show some sort of gratitude for you and mark for sure!

1 Like

I was just going to post something.

Glad you go it! :clap:

FYI: I had to make the photosphere bigger. I made it size 10,10,10.
I also set the Cookies group to position of 0,0,-4.5 and changed the count from 10 to 8. for me the cookies lay across the table.

Steve

1 Like