I know device DeviceOrientation example has been removed due to inconsistent behavior across devices but ii think this usecase can still work without issues .
Camera is fixed and only small movement is used to tilt the camera ,like this video
i made a pivotGroup at the 0,0,0 and put the camera at 0,0,5 and added it as child of the pivotgroup
then output of the deviceOrientation controls(quaternion) is copied to the group
it works nicely ,but the model loads behind me or some other direction most of the time .
i tried adding dynamically adding alpha offset so that the model comes to the center , but pivotGroup.rotation.y = 0 is applicable for both front and back orientation so camera ends up looking behind the intended direction
anyone know how to lock on the model and just use subtle movement for tilting ?
const alpha = device.alpha + offset.y
const beta = device.beta + offset.x
const gamma = device.gamma
const orient = scope.screenOrientation
if (alpha && beta && gamma) {
gyroEuler.set(beta, alpha, gamma)
_euler.set(
THREE.MathUtils.degToRad(beta),
THREE.MathUtils.degToRad(alpha),
- THREE.MathUtils.degToRad(gamma),
"YXZ") // 'ZXY' for the device, but 'YXZ' for us
rawOutputQuaternion.setFromEuler(_euler) // orient the device
rawOutputQuaternion.multiply(_q1) // camera looks out the back of the device, not the top
rawOutputQuaternion.multiply(_q0.setFromAxisAngle(_zee, -THREE.MathUtils.degToRad(orient))) // adjust for screen orientation
pivotGroup.quaternion.copy(rawOutputQuaternion)