main: minor bugfix
This commit is contained in:
parent
a54ff56a8d
commit
4d68b50ede
3 changed files with 5 additions and 7 deletions
1
index.glb
Symbolic link
1
index.glb
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
example/assets/index.glb
|
||||||
1
other.glb
Symbolic link
1
other.glb
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
example/assets/other.glb
|
||||||
|
|
@ -2,19 +2,15 @@ xrf.frag.pos = function(v, opts){
|
||||||
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
||||||
|
|
||||||
let pos = v
|
let pos = v
|
||||||
|
console.dir(pos)
|
||||||
// spec: indirect coordinate using objectname: https://xrfragment.org/#navigating%203D
|
// spec: indirect coordinate using objectname: https://xrfragment.org/#navigating%203D
|
||||||
if( pos.x == undefined ){
|
if( pos.x == undefined ){
|
||||||
let obj = scene.getObjectByName(v.string)
|
let obj = scene.getObjectByName(v.string)
|
||||||
if( !obj ) return
|
if( !obj ) return console.warn("#pos="+v.string+" not found")
|
||||||
pos = obj.position.clone()
|
|
||||||
obj.getWorldPosition(pos)
|
|
||||||
camera.position.copy(pos)
|
|
||||||
obj.attach(camera)
|
|
||||||
camera.position.set(0,0,0)
|
camera.position.set(0,0,0)
|
||||||
|
obj.attach(camera)
|
||||||
let c = camera.getCam().rotation
|
let c = camera.getCam().rotation
|
||||||
c.set( c.x, obj.rotation.y, c.z )
|
c.set( c.x, obj.rotation.y, c.z )
|
||||||
|
|
||||||
obj.updateMatrixWorld(); // Update parent’s world matrix
|
obj.updateMatrixWorld(); // Update parent’s world matrix
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue