How do I achieve this quiz effect?

Hi Everyone!

I'm currently working on a trivia quiz lens.
I'd like it to work exactly like this one:
https://lens.snapchat.com/aff77f7bcc5f4b80a27890543955bbef

How it works?
• Question on top of head
• Two answers (one on the left and one on the right)
• User tilts head left or right to select answer

What I managed to complete
• All graphics and questions are ready
• I have used the 'head tilt' asset/script to allow user to select answer

E.g.
Head tilt script + behaviour script:
on custom trigger
ON_LEFT - set colour of correct answer to green
ON_RIGHT - set colour of wrong answer to red

What I'm struggling with?
I've managed to achieve everything except going to the next question.
Once first question answered with head tilt, show next question.

I tried using the behaviour script to disable and enable questions once the previous is answered, however it seems like questions are still being affected by ON_LEFT & ON_RIGHT even while disabled and are being answered before the user even sees the question.

One more idea I had is to create a counter and do something like

On trigger ON_LEFT & ON_RIGHT, increase counter by 1
then:
If counter = 1, hide question 1
if counter = 2, hide question 2
and so on...

but I'm not sure how to exactly integrate this with the 'head tilt' in Javascript, or if it'll even work.

Any ideas on how I can do this? Thanks in advance everyone!

Best Answer

Answers

  • brandon
    brandon Posts: 15 🔥
    edited August 2022 #3

    I'm actually the developer of that wikipedia game lens, made for a client lol. Cool to see it mentioned :)

    I have a custom implementation but looks like it's still doable with your setup. The big difference I see is that I don't actually change the question until the head is centered by the user. I found user's kinda naturally recenter their head after answering so it isn't an issue.

    In the tilt head script you are using, the "on reset" function is called when the head returns to the center. So you could probably have one of those setup for each question and call the question change when that is fired.

    Let me know if this fix doesn't work, then I can look for another method.

  • Hi I'm also trying to make a lens exactly like that! Do you have a dummy project for this? Or which template did you start out with? Thanks!

  • Laurent 🤘
    Laurent 🤘 Posts: 1
    edited November 2022 #5

    Your lens is cool @brandon (as usual ) !
    @Monkey XR did you find a template ? I’m trying to work on a template for my student but unit now … 😬

  • @Monkey XR @brandon @Laurent 🤘 same here, so hard to do this project without template, can i ask the dummy project ?

  • Hello @brandon ,
    Hello @Aleks Brzoska ,
    I am currently writing my bachelor thesis and need the quiz, do you have a template for me?

  • Hello @Laurent 🤘 ,
    Hello @Monkey XR ,
    did you find a template? I need it for my bachelorthesis

  • Is there a tutorial for this? @brandon

  • rosefromtitani
    rosefromtitani Posts: 4
    edited March 2023 #10

    Hello everyone, a newbie aboard, did anybody get the tutorial? I am a student at the college of mathematics and physics and need to create a quiz based on a research paper of a famous researcher.

  • stevenxu
    stevenxu Posts: 542 👻

    Thanks for closing the loop @Aleks Brzoska !!!

    @rosefromtitani @Ziyaa Boghani I would see the "best answer" post right under the original post

  • Oh, yeah, thanks!*