Eating game logic & scripting help

Hello,
Working on a logic to create a game where food items are falling from above and the person has to eat the falling objects to get points any guidance on how I can script such a game with some reference would be really helpful & much appreciated.

Hey,

You can work out if the user’s mouth is open by calculating the distance between the lip landmarks - Reference project.

Use something like a trigger volume to test the collisions.

It may be handy to look at PC’s physics tutorials and how to programmatically create entities.

Hi @Deim, Thank you for the references. I tried the trigger volume part that you have stated and it works pretty nicely,I have added sound and score as well as console logs. The issue here now is how to disable the script when the mouth is closed so that it stops the sound and score.
here is the link to the project as reference: https://playcanvas.com/project/868564/overview/deepdive
script name is TriggerVolume.js

No worries! I’ve had a look at the project you’ve linked, and it looks like you’ve already figured that part out :slight_smile:

@Deim, I tried but its not actually working precisely for me once the triggerleave event is triggered the triggerEnter event has issues re triggering. So I cannot keeep the mouth open continuously after that I guess as it stops the triggerEnter event after one trigger.