Head Touch Input
StudioThis project demonstrates an input system for a game that utilizes head tilt controls and touchscreen controls to trigger events.
This project demonstrates an input system for a game that utilizes head tilt controls and touchscreen controls to trigger events.
Head Touch Input Overview This project demonstrates an input system for a game that utilizes head tilt controls and touchscreen controls to collect falling sushi.
Controls Players can collect sushi using:
Head Tilt: Tilt your head to the left or right.
Touchscreen Tap: Tap the left or right side of the screen.
Each successful action provides feedback and increases the score by 1.
Components InputController Description: Detects head tilts and finger touches to trigger input events.
Schema:
Data:
hitLeft: (Boolean) Indicates if the left input was hit. hitRight: (Boolean) Indicates if the right input was hit. canHitLeft: (Boolean) Indicates if the left input is allowed. canHitRight: (Boolean) Indicates if the right input is allowed. touchTriggeredLeft: (Boolean) Tracks if a touch was triggered on the left side. touchTriggeredRight: (Boolean) Tracks if a touch was triggered on the right side. Functionality:
Detects finger inputs via an event listener. Based on the screen size, it provides appropriate feedback and increases the score by 1. Detects head tilt input based on the Z-axis rotation. Users must return their head to a neutral position before registering another tilt. UIRewardController Description: Listens to events from the InputController and updates the score displayed in the UI. GameManager Description: Implements a state machine for transitioning between the Title Screen and Gameplay states. Project Setup The InputController component is attached to the face object for input detection.
The GameManager and UIRewardController components are attached to separate game objects to manage game flow and UI updates.
Customization The InputController is flexible and allows for additional functionality. You can:
Fire custom events from the InputController.
Add features such as notifications or other UI updates.
In the example project, the controller displays a notification and updates the score in the UI when a successful action is performed.
Credits Developed by Saul Pena Gamero and Mackenzie Li
Other Work by Saul Pena Gamero