wip
This commit is contained in:
parent
ee3d430261
commit
39463736e1
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
10
index.html
10
index.html
File diff suppressed because one or more lines are too long
|
@ -67,6 +67,21 @@ window.AFRAME.registerComponent('xrf', {
|
|||
}
|
||||
xrf.addEventListener('interactionReady', AFRAME.XRF.clickableMeshToEntity )
|
||||
|
||||
// xrf.addEventListener('interactionReady', () => {
|
||||
// let raycasters = [ ...document.querySelectorAll('[raycaster]') ]
|
||||
// raycasters.map( (rc) => {
|
||||
// rc = rc.components['raycaster']
|
||||
// rc.refreshObjects = () => {
|
||||
// rc.objects = xrf.interactive.objects.map( (o) => ({ ...o, el:{} }) ) // AFRAME raycaster requires 'el' property
|
||||
// console.log("refreshing")
|
||||
// rc.dirty = false
|
||||
// }
|
||||
// rc.dirty = true
|
||||
// rc.refreshObjects()
|
||||
// })
|
||||
// })
|
||||
|
||||
|
||||
// cleanup xrf-get objects when resetting scene
|
||||
xrf.reset = ((reset) => () => {
|
||||
reset()
|
||||
|
|
|
@ -21,10 +21,11 @@ window.AFRAME.registerComponent('xrf-get', {
|
|||
return;
|
||||
}
|
||||
// convert to worldcoordinates
|
||||
mesh.getWorldPosition(mesh.position)
|
||||
mesh.getWorldScale(mesh.scale)
|
||||
mesh.getWorldQuaternion(mesh.quaternion)
|
||||
// mesh.getWorldPosition(mesh.position)
|
||||
// mesh.getWorldScale(mesh.scale)
|
||||
// mesh.getWorldQuaternion(mesh.quaternion)
|
||||
mesh.isXRF = true // mark for deletion by xrf
|
||||
this.el.object3D.add = (a) => a // dummy
|
||||
this.el.setObject3D('mesh',mesh)
|
||||
// normalize position
|
||||
//this.el.object3D.position.copy( mesh.position )
|
||||
|
|
|
@ -131,9 +131,9 @@ xrf.InteractiveGroup = function(THREE,renderer,camera){
|
|||
|
||||
}
|
||||
|
||||
add(obj){
|
||||
Group.prototype.add.call( this, obj )
|
||||
this.objects = ([]).concat( this.children )
|
||||
add(obj, unparent){
|
||||
if( unparent ) Group.prototype.add.call( this, obj )
|
||||
this.objects.push(obj)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -131,12 +131,12 @@ xrf.frag.href = function(v, opts){
|
|||
|
||||
// lazy add mesh (because we're inside a recursive traverse)
|
||||
setTimeout( (mesh) => {
|
||||
mesh.getWorldPosition(world.pos)
|
||||
mesh.getWorldScale(world.scale)
|
||||
mesh.getWorldQuaternion(world.quat);
|
||||
mesh.position.copy(world.pos)
|
||||
mesh.scale.copy(world.scale)
|
||||
mesh.setRotationFromQuaternion(world.quat);
|
||||
//mesh.getWorldPosition(world.pos)
|
||||
//mesh.getWorldScale(world.scale)
|
||||
//mesh.getWorldQuaternion(world.quat);
|
||||
//mesh.position.copy(world.pos)
|
||||
//mesh.scale.copy(world.scale)
|
||||
//mesh.setRotationFromQuaternion(world.quat);
|
||||
xrf.interactive.add(mesh)
|
||||
xrf.emit('interactionReady', {mesh,xrf:v,clickHandler: mesh.userData.XRF.href.exec })
|
||||
}, 0, mesh )
|
||||
|
|
Loading…
Reference in New Issue