xrfragment-haxe/src/3rd/js/three/xrf/rot.js

24 lines
651 B
JavaScript
Raw Normal View History

xrf.frag.rot = function(v, opts){
let { frag, mesh, model, camera, scene, renderer, THREE} = opts
if( xrf.debug ) console.log("#rot.js: setting camera rotation to "+v.string)
if( !camera || !scene ) return
if( !model.isSRC ){
camera.rotation.set(
v.x * Math.PI / 180,
v.y * Math.PI / 180,
v.z * Math.PI / 180
)
camera.rotation.offset = camera.rotation.clone() // remember
//camera.updateProjectionMatrix()
}else{
obj = model.scene.isReparented ? model.scene.children[0] : model.scene
obj.rotation.set(
v.x * Math.PI / 180,
v.y * Math.PI / 180,
v.z * Math.PI / 180
)
}
2023-05-09 17:42:29 +02:00
}