Objective:
- Use gesture to select an auto-generated button
- Generate new design object from backend compiler
Implementation Steps
- Detect hand gesture at every frame, when current gesture is the gesture defined for creating (in our example case, gesture "point"), ready for creating.
- Find index fingertip position.
- Find the button that is within range (use button's WithinRange function as defined before).
- Detect the vertical distance between fingertip and the within-range button.
- If the vertical distance <= "hover threshold" and > "touch threshold", send "hover" signal along with button name (= new object type name) to Update function; change button color to "hover color" (orange).
- If the vertical distance <= "touch threshold", send "touch" signal along with button name to Update function; change button color to "touch color" (green).
- For buttons that are not within range or the vertical distance > "hover distance", all in original/reset color and status, send no signal to Update function.
- In Update function, if the previous frame receives "hover" signal, and the next frame receives "touch" signal (simulate process of pressing a real button), then act on the button name.
- If the button name is object name, send it to backend compiler, and generate new object with initial default parameters.
- If the button is one of the functional buttons ("Reset", "Export", "Delete", "Exit"), define and act correspondingly.
- For convenience of usage, implement "Export" anytime before "Reset", "Delete", and "Exit".
- "Reset", "Export", and "Delete" require first select an object and then take actions.
- "Export" saves both STL file of the selected object and parameters in a text file.
- "Reset" moves the selected object to initial default position, rotation and scale, and all the parameters return to the initial default values.
- "Delete" destroys the object.
- "Exit" exits the system whether in developer's window or play mode.
Demo video of creating new objects
In this demo video, the hand created a Paperbot, a Cat Foil, a Caramaran, and a Rocker Chair.
Limitation:
- As seen from the video, when the object is complicated or large, the creating process can take few seconds and the whole scene is frozen during the process.
- The new object is created in the same position every time, which might cause some unnecessary collision and affect user experience.