鼠标和实体控件之间的aframe切换
aframe switching between mouse and entity controls
我在玩家进入 VR 后让鼠标工作时遇到了很多问题。
更新游标属性没有任何作用,所以我尝试删除并替换它们
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)
这类作品从 2D 切换到 VR 会超时,但切换回去又是一大痛点。
在框架中执行此操作的最佳方法是什么?
我试过了,没用。使用鼠标,进入 VR 时不会切换到光标控件。
this._recticle.setAttribute('cursor', {fuse: false, rayOrigin: 'mouse'})
else
this._recticle.setAttribute('cursor', {fuse: true,rayOrigin: 'entity', fuseTimeout: 2000})
相反的是 rayOrigin: entity
。
在场景和相机中有一个单独的光标,然后你可以同时拥有两者
我在玩家进入 VR 后让鼠标工作时遇到了很多问题。
更新游标属性没有任何作用,所以我尝试删除并替换它们
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)
这类作品从 2D 切换到 VR 会超时,但切换回去又是一大痛点。
在框架中执行此操作的最佳方法是什么?
我试过了,没用。使用鼠标,进入 VR 时不会切换到光标控件。
this._recticle.setAttribute('cursor', {fuse: false, rayOrigin: 'mouse'})
else
this._recticle.setAttribute('cursor', {fuse: true,rayOrigin: 'entity', fuseTimeout: 2000})
相反的是 rayOrigin: entity
。
在场景和相机中有一个单独的光标,然后你可以同时拥有两者