Skip to content

Repository files navigation

Domingo Cook - CS 4331 - Project 1

Project Link

Virtual Restaurant in the Pandemic

Door Control

Javascript - This function is called when an item with class clickable is clicked. An event is bound which looks for the door id and toggles the position/rotation of a given door.

toggleOpen(el, newOpen, '0 0 0', '0 -90 0', '4 0 4', '0 0 0')
...
function toggleOpen(el, isOpen, positionClosed, rotationClosed, positionOpen, rotationOpen) {
  if (isOpen) {
    el.setAttribute('position', positionOpen);
    el.setAttribute('rotation', rotationOpen);
  } else {
    el.setAttribute('position', positionClosed);
    el.setAttribute('rotation', rotationClosed);
  }
}

HTML - Sound and click toggle attributes

<a-entity gltf-model="#door" door id="door1" sound="src: #doorSound; on: click" class="clickable" isOpen="false"></a-entity>

Door Control

Covid - Caution Cone Control

Cones are set up during covid mode to block access to seating and promote social distancing. These can be toggled with the yellow button by the registers.

Javascript - Get all Covid elements and toggle visibility

Array.from(document.getElementsByClassName('covid')).forEach(covidItem => {
  covidItem.setAttribute('visible', !(covidItem.getAttribute('visible')))
});

HTML - Example Covid object

<a-entity gltf-model="#cone" id="cone" class="covid" visible="false"></a-entity>

Covid Control Gif Covid Cone Display

Light Control

Javascript - Given the light's current intensity, it is cycled through lightArr and wraps to the start of the array when accessing an out of index value.

const lightArr = ['0.2', '0.4', '0.6', '0.8', '1']
...
let light = document.getElementById('light');
let newLightIndex = lightArr.indexOf(light.getAttribute('intensity')) + 1;
light.setAttribute('intensity', lightArr[(newLightIndex % lightArr.length + lightArr.length) % lightArr.length])

HTML - A simple a-light with a default intensity is required.

<a-light id="light" type="hemisphere" intensity="0.6" position="0 2 0"></a-light>

Light Control

Project Design

My Assets

  1. Scene

  2. Tall Chair

  3. Freestyle Soda Machine

  4. Trash Can

  5. Cone

  6. Table Booths

  7. Table Wide

  8. Table Thin

  9. Door

  10. Register

  11. Ice Cream Machine

  12. Foot Pedal Sink

  13. Stove Set

  14. Fryer Set

  15. Industrial Sink

  16. 17, 18, 19, 20 - Various Tables

My Assets Image

External Assets

Food Content Pack

Food Content Image

Door Sound

Door Sound Image

References

Aframe Docs Angular Docs Blender Manual

Build Information

This project was generated with Angular CLI version 8.3.17.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build to build the project.

Build - Prod

Run ng run build-prod to build locally to /dist/. This is used for deployment with Angular GitHub Pages

Deploy

Run ng run deploy deploy the /dist/ directory to GitHub.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages