From 4d68b50edea4e847510c5dd495d8980d5d5c943b Mon Sep 17 00:00:00 2001 From: Leon van Kammen Date: Tue, 8 Oct 2024 17:11:14 +0200 Subject: [PATCH] main: minor bugfix --- index.glb | 1 + other.glb | 1 + src/3rd/js/three/xrf/pos.js | 10 +++------- 3 files changed, 5 insertions(+), 7 deletions(-) create mode 120000 index.glb create mode 120000 other.glb diff --git a/index.glb b/index.glb new file mode 120000 index 0000000..dc8f849 --- /dev/null +++ b/index.glb @@ -0,0 +1 @@ +example/assets/index.glb \ No newline at end of file diff --git a/other.glb b/other.glb new file mode 120000 index 0000000..70a12bd --- /dev/null +++ b/other.glb @@ -0,0 +1 @@ +example/assets/other.glb \ No newline at end of file diff --git a/src/3rd/js/three/xrf/pos.js b/src/3rd/js/three/xrf/pos.js index fc7d9e4..a81e0dd 100644 --- a/src/3rd/js/three/xrf/pos.js +++ b/src/3rd/js/three/xrf/pos.js @@ -2,19 +2,15 @@ xrf.frag.pos = function(v, opts){ let { frag, mesh, model, camera, scene, renderer, THREE} = opts let pos = v - + console.dir(pos) // spec: indirect coordinate using objectname: https://xrfragment.org/#navigating%203D if( pos.x == undefined ){ let obj = scene.getObjectByName(v.string) - if( !obj ) return - pos = obj.position.clone() - obj.getWorldPosition(pos) - camera.position.copy(pos) - obj.attach(camera) + if( !obj ) return console.warn("#pos="+v.string+" not found") camera.position.set(0,0,0) + obj.attach(camera) let c = camera.getCam().rotation c.set( c.x, obj.rotation.y, c.z ) - obj.updateMatrixWorld(); // Update parent’s world matrix }else{