I'm having massive problems getting mouse to work after the player has been in VR.
Updating the cursor attributes didn't do anything, so I've tried removing and replacing them
getRayCasterAttributes: function(){
return this.data.isVR ?
{
cursorAttributes:{
fuse: true,
fuseTimeout: cursorFuseTimeout,
},
raycasterAttributes: {
objects: '[data-raycastable]',
},
} :
{cursorAttributes:{
fuse: true,
fuseTimeout: cursorFuseTimeout,
rayOrigin: 'mouse',
},
raycasterAttributes: {
objects: '[data-raycastable]',
},
}
}
if(oldData.isVR !== this.data.isVR){
this._recticle.object3D.visible = this.data.isVR
this._recticle.removeAttribute('raycaster')
this._recticle.removeAttribute('cursor')
setTimeout(() => {
console.log(this.getRayCasterAttributes().raycasterAttributes, this.getRayCasterAttributes().cursorAttributes)
this._recticle.setAttribute('raycaster', this.getRayCasterAttributes().raycasterAttributes)
this._recticle.setAttribute('cursor', this.getRayCasterAttributes().cursorAttributes)
},100)
This kind of works switching from 2D to VR with the timeout, but switching back is another major pain.
What is the best way to do this in aframe?
I've tried this, isn't helping. Works with mouse, does not switch to cursor controls when entering VR.
this._recticle.setAttribute('cursor', {fuse: false, rayOrigin: 'mouse'})
else
this._recticle.setAttribute('cursor', {fuse: true,rayOrigin: 'entity', fuseTimeout: 2000})
The opposite would be rayOrigin: entity
.