Skip to content

Instantly share code, notes, and snippets.

@thenayr
Created November 19, 2016 22:05
Show Gist options
  • Save thenayr/7500ee6129a1d9dbe9d6bb1e3d395f84 to your computer and use it in GitHub Desktop.
Save thenayr/7500ee6129a1d9dbe9d6bb1e3d395f84 to your computer and use it in GitHub Desktop.
Code to reset the sphere colliders on the vive controllers
componentDidMount() {
// Fun hack to make physics and grab register newly added objects
[].slice.call(document.querySelectorAll('.controllers')).forEach((el) => el.removeAttribute('sphere-collider'));
[].slice.call(document.querySelectorAll('.controllers')).forEach((el) => el.setAttribute('sphere-collider', 'objects: .pod;'));
// [].slice.call(document.querySelectorAll('.controllers')).forEach((el) => el.components['sphere-collider'].update);
// Enable physics on the appended object
ReactDom.findDOMNode(this.refs.pod).setAttribute('dynamic-body', '');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment