Created
November 19, 2016 22:05
-
-
Save thenayr/7500ee6129a1d9dbe9d6bb1e3d395f84 to your computer and use it in GitHub Desktop.
Code to reset the sphere colliders on the vive controllers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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