troisjs / trois

✨ ThreeJS + VueJS 3 + ViteJS ⚡
https://troisjs.github.io
MIT License
4.24k stars 304 forks source link

vr support ? #16

Open klevron opened 3 years ago

klevron commented 3 years ago

Added a simple vr support : https://github.com/troisjs/trois/blob/0.3.0-beta.0/src/core/Renderer.ts#L195 https://github.com/troisjs/trois/blob/0.3.0-beta.0/src/components/misc/VRButton.vue

Will add example later

okydk commented 3 years ago

I've added the xr prop to the renderer but still get an error when starting a VR session. Any ideas?

VRButton.vue:55 Uncaught (in promise) TypeError: this.renderer.xr.setSession is not a function
klevron commented 3 years ago

Sorry I didn't have time to improve this and add example.

You should set a ref on the button :

<VRButton ref="vrbutton" />

And call init() in mounted() : this.$refs.vrbutton.init(this.$refs.renderer.renderer)