2023-05-12 22:06:21 +02:00
|
|
|
xrf.frag.pos = function(v, opts){
|
2023-05-09 17:42:29 +02:00
|
|
|
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
|
2023-11-24 17:32:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// spec: indirect coordinate using objectname: https://xrfragment.org/#navigating%203D
|
|
|
|
|
if( v.x == undefined ){
|
|
|
|
|
let obj = scene.getObjectByName(v.string)
|
|
|
|
|
if( !obj ) return
|
|
|
|
|
let pos = obj.position.clone()
|
|
|
|
|
obj.getWorldPosition(pos)
|
|
|
|
|
camera.position.copy(pos)
|
|
|
|
|
}else{
|
|
|
|
|
// spec: direct coordinate: https://xrfragment.org/#navigating%203D
|
|
|
|
|
camera.position.x = v.x
|
|
|
|
|
camera.position.y = v.y
|
|
|
|
|
camera.position.z = v.z
|
|
|
|
|
}
|
2023-05-04 21:28:12 +02:00
|
|
|
}
|