Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flushpot1125/e97b202764284d6db295f7a3105d5c06 to your computer and use it in GitHub Desktop.
Save flushpot1125/e97b202764284d6db295f7a3105d5c06 to your computer and use it in GitHub Desktop.
//Trigger button
var leftLastTriggerValue,rightLastTriggerValue;
webVRController.onTriggerStateChangedObservable.add((stateObject)=>{
if(webVRController.hand ==='left'){
if(leftLastTriggerValue < 0.9 && stateObject.value >= 0.9){
console.log("Left main Trigger button pressed");
}
leftLastTriggerValue = stateObject.value;
}else{
if(rightLastTriggerValue < 0.9 && stateObject.value >= 0.9){
console.log("Right main Trigger button pressed");
}
rightLastTriggerValue = stateObject.value;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment