working demo

real-world-meshing
Fabien Benetou 5 months ago
parent e84257a92b
commit c10f90aeb5
  1. 25
      index.html

@ -13,6 +13,31 @@
<body> <body>
<script> <script>
const SpeechRecognition = window.webkitSpeechRecognition;
recognizer = new SpeechRecognition();
recognizer.interimResults = true;
recognizer.continuous = true;
recognizer.lang = 'en-US';
recognizer.onresult = (event) => {
let result = event.results[event.resultIndex]
if (result.isFinal) {
console.log('You said: ' + result[0].transcript + '_END')
if ( result[0].transcript == "Add red cube"){
// should instead look for syntax e.g ACTION PROPERTY_SHORTCUT ENTITY_TYPE
// itself generated from AFrame introspection
console.log("recognized command")
let el = document.createElement("a-box")
el.setAttribute("color", "red")
el.setAttribute("target", "")
el.setAttribute("scale", ".1 .1 .1")
el.setAttribute("position", "0 1.5 -0.4")
AFRAME.scenes[0].appendChild( el )
}
}
}
recognizer.start();
var forceXaxis var forceXaxis
// setInterval( _ => console.log(forceXaxis), 1000) // setInterval( _ => console.log(forceXaxis), 1000)

Loading…
Cancel
Save