bugfix: move camera only in world coordinates

This commit is contained in:
Leon van Kammen 2024-12-10 14:35:11 +00:00
parent 186f2af440
commit 9fc7d3c6f6
1 changed files with 4 additions and 4 deletions

View File

@ -6,10 +6,10 @@ xrf.frag.pos = function(v, opts){
if( pos.x == undefined ){ if( pos.x == undefined ){
let obj = scene.getObjectByName(v.string) let obj = scene.getObjectByName(v.string)
if( !obj ) return console.warn("#pos="+v.string+" not found") if( !obj ) return console.warn("#pos="+v.string+" not found")
obj.add(camera) let worldPos = obj.getWorldPosition( obj.position )
camera.position.set(0,0,0) camera.position.copy( worldPos )
let c = camera.rotation //let c = camera.rotation
c.set( c.x, obj.rotation.y, c.z ) //c.set( c.x, obj.rotation.y, c.z )
}else{ }else{
// spec: direct coordinate: https://xrfragment.org/#navigating%203D // spec: direct coordinate: https://xrfragment.org/#navigating%203D