better support for camera-switching/animation

This commit is contained in:
Leon van Kammen 2024-10-07 19:02:52 +00:00
parent 2ce60fc493
commit 676b8d1fd2
17 changed files with 62414 additions and 20 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,175 @@
/* /*
* v0.5.1 generated at Tue Sep 24 06:21:18 PM CEST 2024 * v0.5.1 generated at Mon Oct 7 06:59:29 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:57:59 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:57:18 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:56:43 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:51:36 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:51:04 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:50:49 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:44:42 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:44:24 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:43:43 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:43:05 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:42:07 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:41:46 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:40:25 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:39:56 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:39:23 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:38:35 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:38:22 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:35:57 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:35:25 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:35:08 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:34:09 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:33:36 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:27:53 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:24:08 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:22:12 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:20:44 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:16:57 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:15:56 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:06:45 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:06:19 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 05:25:56 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 09:10:32 AM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 09:03:16 AM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 09:02:57 AM UTC 2024
* https://xrfragment.org * https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
@ -1701,7 +1871,7 @@ xrf.query = function(){
xrf.detectCameraRig = function(opts){ xrf.detectCameraRig = function(opts){
if( opts.camera ){ // detect rig (if any) if( opts.camera ){ // detect rig (if any)
let getCam = ((cam) => () => cam)(opts.camera) const getCam = ((cam) => () => cam)(opts.camera)
let offsetY = 0 let offsetY = 0
while( opts.camera.parent.type != "Scene" ){ while( opts.camera.parent.type != "Scene" ){
offsetY += opts.camera.position.y offsetY += opts.camera.position.y
@ -1709,6 +1879,7 @@ xrf.detectCameraRig = function(opts){
opts.camera.getCam = getCam opts.camera.getCam = getCam
opts.camera.updateProjectionMatrix = () => opts.camera.getCam().updateProjectionMatrix() opts.camera.updateProjectionMatrix = () => opts.camera.getCam().updateProjectionMatrix()
} }
if( !opts.camera.getCam ) opts.camera.getCam = getCam // always attach function
opts.camera.offsetY = offsetY opts.camera.offsetY = offsetY
} }
} }
@ -2517,6 +2688,13 @@ xrf.frag.pos = function(v, opts){
pos = obj.position.clone() pos = obj.position.clone()
obj.getWorldPosition(pos) obj.getWorldPosition(pos)
camera.position.copy(pos) camera.position.copy(pos)
obj.attach(camera)
camera.position.set(0,0,0)
let c = camera.getCam().rotation
c.set( c.x, obj.rotation.y, c.z )
obj.updateMatrixWorld(); // Update parents world matrix
}else{ }else{
// spec: direct coordinate: https://xrfragment.org/#navigating%203D // spec: direct coordinate: https://xrfragment.org/#navigating%203D
camera.position.x = pos.x camera.position.x = pos.x
@ -5133,6 +5311,7 @@ window.AFRAME.registerComponent('xrf-get', {
}else{ }else{
// lets create a dummy add function so that the mesh won't get reparented during setObject3D // lets create a dummy add function so that the mesh won't get reparented during setObject3D
// as this would break animations // as this would break animations
// maybe we need THREE.js attach() for this?
this.el.object3D.add = (a) => a this.el.object3D.add = (a) => a
} }
this.el.object3D.parent = mesh.parent this.el.object3D.parent = mesh.parent

175
dist/xrfragment.js vendored
View File

@ -1,3 +1,178 @@
/*
* v0.5.1 generated at Mon Oct 7 06:59:29 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:57:59 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:57:18 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:56:43 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:51:36 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:51:04 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:50:49 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:44:42 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:44:24 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:43:43 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:43:05 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:42:07 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:41:46 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:40:25 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:39:56 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:39:23 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:38:35 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:38:22 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:35:57 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:35:25 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:35:08 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:34:09 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:33:36 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:27:53 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:24:08 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:22:12 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:20:44 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:16:57 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:15:56 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:06:45 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:06:19 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 05:25:56 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 09:10:32 AM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 09:03:16 AM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 09:02:57 AM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/* /*
* v0.5.1 generated at Fri Aug 2 10:04:04 AM UTC 2024 * v0.5.1 generated at Fri Aug 2 10:04:04 AM UTC 2024
* https://xrfragment.org * https://xrfragment.org

File diff suppressed because one or more lines are too long

61320
dist/xrfragment.module.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* /*
* v0.5.1 generated at Tue Sep 24 06:21:18 PM CEST 2024 * v0.5.1 generated at Mon Oct 7 06:59:29 PM UTC 2024
* https://xrfragment.org * https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* v0.5.1 generated at Tue Sep 24 06:21:18 PM CEST 2024 * v0.5.1 generated at Mon Oct 7 06:59:29 PM UTC 2024
* https://xrfragment.org * https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* v0.5.1 generated at Tue Sep 24 06:21:18 PM CEST 2024 * v0.5.1 generated at Mon Oct 7 06:59:29 PM UTC 2024
* https://xrfragment.org * https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* v0.5.1 generated at Tue Sep 24 06:21:18 PM CEST 2024 * v0.5.1 generated at Mon Oct 7 06:59:29 PM UTC 2024
* https://xrfragment.org * https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* v0.5.1 generated at Tue Sep 24 06:21:18 PM CEST 2024 * v0.5.1 generated at Mon Oct 7 06:59:29 PM UTC 2024
* https://xrfragment.org * https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* v0.5.1 generated at Tue Sep 24 06:21:18 PM CEST 2024 * v0.5.1 generated at Mon Oct 7 06:59:29 PM UTC 2024
* https://xrfragment.org * https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */

View File

@ -1,5 +1,175 @@
/* /*
* v0.5.1 generated at Tue Sep 24 06:21:18 PM CEST 2024 * v0.5.1 generated at Mon Oct 7 06:59:29 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:57:59 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:57:18 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:56:43 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:51:36 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:51:04 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:50:49 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:44:42 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:44:24 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:43:43 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:43:05 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:42:07 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:41:46 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:40:25 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:39:56 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:39:23 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:38:35 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:38:22 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:35:57 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:35:25 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:35:08 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:34:09 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:33:36 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:27:53 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:24:08 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:22:12 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:20:44 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:16:57 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:15:56 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:06:45 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:06:19 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 05:25:56 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 09:10:32 AM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 09:03:16 AM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 09:02:57 AM UTC 2024
* https://xrfragment.org * https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
@ -1701,7 +1871,7 @@ xrf.query = function(){
xrf.detectCameraRig = function(opts){ xrf.detectCameraRig = function(opts){
if( opts.camera ){ // detect rig (if any) if( opts.camera ){ // detect rig (if any)
let getCam = ((cam) => () => cam)(opts.camera) const getCam = ((cam) => () => cam)(opts.camera)
let offsetY = 0 let offsetY = 0
while( opts.camera.parent.type != "Scene" ){ while( opts.camera.parent.type != "Scene" ){
offsetY += opts.camera.position.y offsetY += opts.camera.position.y
@ -1709,6 +1879,7 @@ xrf.detectCameraRig = function(opts){
opts.camera.getCam = getCam opts.camera.getCam = getCam
opts.camera.updateProjectionMatrix = () => opts.camera.getCam().updateProjectionMatrix() opts.camera.updateProjectionMatrix = () => opts.camera.getCam().updateProjectionMatrix()
} }
if( !opts.camera.getCam ) opts.camera.getCam = getCam // always attach function
opts.camera.offsetY = offsetY opts.camera.offsetY = offsetY
} }
} }
@ -2517,6 +2688,13 @@ xrf.frag.pos = function(v, opts){
pos = obj.position.clone() pos = obj.position.clone()
obj.getWorldPosition(pos) obj.getWorldPosition(pos)
camera.position.copy(pos) camera.position.copy(pos)
obj.attach(camera)
camera.position.set(0,0,0)
let c = camera.getCam().rotation
c.set( c.x, obj.rotation.y, c.z )
obj.updateMatrixWorld(); // Update parents world matrix
}else{ }else{
// spec: direct coordinate: https://xrfragment.org/#navigating%203D // spec: direct coordinate: https://xrfragment.org/#navigating%203D
camera.position.x = pos.x camera.position.x = pos.x

View File

@ -1,5 +1,175 @@
/* /*
* v0.5.1 generated at Tue Sep 24 06:21:18 PM CEST 2024 * v0.5.1 generated at Mon Oct 7 06:59:29 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:57:59 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:57:18 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:56:43 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:51:36 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:51:04 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:50:49 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:44:42 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:44:24 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:43:43 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:43:05 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:42:07 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:41:46 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:40:25 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:39:56 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:39:23 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:38:35 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:38:22 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:35:57 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:35:25 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:35:08 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:34:09 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:33:36 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:27:53 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:24:08 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:22:12 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:20:44 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:16:57 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:15:56 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:06:45 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 06:06:19 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 05:25:56 PM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 09:10:32 AM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 09:03:16 AM UTC 2024
* https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/*
* v0.5.1 generated at Mon Oct 7 09:02:57 AM UTC 2024
* https://xrfragment.org * https://xrfragment.org
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
@ -1701,7 +1871,7 @@ xrf.query = function(){
xrf.detectCameraRig = function(opts){ xrf.detectCameraRig = function(opts){
if( opts.camera ){ // detect rig (if any) if( opts.camera ){ // detect rig (if any)
let getCam = ((cam) => () => cam)(opts.camera) const getCam = ((cam) => () => cam)(opts.camera)
let offsetY = 0 let offsetY = 0
while( opts.camera.parent.type != "Scene" ){ while( opts.camera.parent.type != "Scene" ){
offsetY += opts.camera.position.y offsetY += opts.camera.position.y
@ -1709,6 +1879,7 @@ xrf.detectCameraRig = function(opts){
opts.camera.getCam = getCam opts.camera.getCam = getCam
opts.camera.updateProjectionMatrix = () => opts.camera.getCam().updateProjectionMatrix() opts.camera.updateProjectionMatrix = () => opts.camera.getCam().updateProjectionMatrix()
} }
if( !opts.camera.getCam ) opts.camera.getCam = getCam // always attach function
opts.camera.offsetY = offsetY opts.camera.offsetY = offsetY
} }
} }
@ -2517,6 +2688,13 @@ xrf.frag.pos = function(v, opts){
pos = obj.position.clone() pos = obj.position.clone()
obj.getWorldPosition(pos) obj.getWorldPosition(pos)
camera.position.copy(pos) camera.position.copy(pos)
obj.attach(camera)
camera.position.set(0,0,0)
let c = camera.getCam().rotation
c.set( c.x, obj.rotation.y, c.z )
obj.updateMatrixWorld(); // Update parents world matrix
}else{ }else{
// spec: direct coordinate: https://xrfragment.org/#navigating%203D // spec: direct coordinate: https://xrfragment.org/#navigating%203D
camera.position.x = pos.x camera.position.x = pos.x

View File

@ -164,19 +164,16 @@
const handModel1 = new OculusHandModel( hand1 ); const handModel1 = new OculusHandModel( hand1 );
hand1.add( handModel1 ); hand1.add( handModel1 );
cameraRig.add( hand1 ); cameraRig.add( hand1 );
console.dir(hand1)
const controllerGrip2 = renderer.xr.getControllerGrip( 1 ); const controllerGrip2 = renderer.xr.getControllerGrip( 1 );
controllerGrip2.add( controllerModelFactory.createControllerModel( controllerGrip2 ) ); controllerGrip2.add( controllerModelFactory.createControllerModel( controllerGrip2 ) );
cameraRig.add( controllerGrip2 ); cameraRig.add( controllerGrip2 );
console.dir(hand1)
// hand2 // hand2
const hand2 = renderer.xr.getHand( 1 ); const hand2 = renderer.xr.getHand( 1 );
const handModel2 = new OculusHandModel( hand2 ); const handModel2 = new OculusHandModel( hand2 );
hand2.add( handModel2 ); hand2.add( handModel2 );
cameraRig.add( hand2 ); cameraRig.add( hand2 );
console.dir(hand2)
// Add stats.js // Add stats.js
stats = new Stats(); stats = new Stats();

View File

@ -41,6 +41,7 @@ window.AFRAME.registerComponent('xrf-get', {
}else{ }else{
// lets create a dummy add function so that the mesh won't get reparented during setObject3D // lets create a dummy add function so that the mesh won't get reparented during setObject3D
// as this would break animations // as this would break animations
// maybe we need THREE.js attach() for this?
this.el.object3D.add = (a) => a this.el.object3D.add = (a) => a
} }
this.el.object3D.parent = mesh.parent this.el.object3D.parent = mesh.parent

View File

@ -26,7 +26,7 @@ xrf.query = function(){
xrf.detectCameraRig = function(opts){ xrf.detectCameraRig = function(opts){
if( opts.camera ){ // detect rig (if any) if( opts.camera ){ // detect rig (if any)
let getCam = ((cam) => () => cam)(opts.camera) const getCam = ((cam) => () => cam)(opts.camera)
let offsetY = 0 let offsetY = 0
while( opts.camera.parent.type != "Scene" ){ while( opts.camera.parent.type != "Scene" ){
offsetY += opts.camera.position.y offsetY += opts.camera.position.y
@ -34,6 +34,7 @@ xrf.detectCameraRig = function(opts){
opts.camera.getCam = getCam opts.camera.getCam = getCam
opts.camera.updateProjectionMatrix = () => opts.camera.getCam().updateProjectionMatrix() opts.camera.updateProjectionMatrix = () => opts.camera.getCam().updateProjectionMatrix()
} }
if( !opts.camera.getCam ) opts.camera.getCam = getCam // always attach function
opts.camera.offsetY = offsetY opts.camera.offsetY = offsetY
} }
} }

View File

@ -10,6 +10,13 @@ xrf.frag.pos = function(v, opts){
pos = obj.position.clone() pos = obj.position.clone()
obj.getWorldPosition(pos) obj.getWorldPosition(pos)
camera.position.copy(pos) camera.position.copy(pos)
obj.attach(camera)
camera.position.set(0,0,0)
let c = camera.getCam().rotation
c.set( c.x, obj.rotation.y, c.z )
obj.updateMatrixWorld(); // Update parents world matrix
}else{ }else{
// spec: direct coordinate: https://xrfragment.org/#navigating%203D // spec: direct coordinate: https://xrfragment.org/#navigating%203D
camera.position.x = pos.x camera.position.x = pos.x