Fix degToRad undefined

The THREE library changes the Math module o MathUtils.
So trying to do Math.degToRad gives an undefined function error.

Fix is to replace Math.degToRad to MathUtils.degToRad.

Signed-off-by: Juan D Polanco Avalos <juan.polanco.avalos@intel.com>
This commit is contained in:
Juan D Polanco Avalos 2022-06-19 13:55:55 -05:00
parent bb2e3dd29c
commit 4721c4cbbd

View file

@ -456,17 +456,17 @@ async function render() {
if (showCalibration) {
// BNO055
let rotationEuler = new THREE.Euler(
THREE.Math.degToRad(360 - orientation[2]),
THREE.Math.degToRad(orientation[0]),
THREE.Math.degToRad(orientation[1]),
THREE.MathUtils.degToRad(360 - orientation[2]),
THREE.MathUtils.degToRad(orientation[0]),
THREE.MathUtils.degToRad(orientation[1]),
'YZX'
);
bunny.setRotationFromEuler(rotationEuler);
} else {
let rotationEuler = new THREE.Euler(
THREE.Math.degToRad(orientation[2]),
THREE.Math.degToRad(orientation[0]-180),
THREE.Math.degToRad(-orientation[1]),
THREE.MathUtils.degToRad(orientation[2]),
THREE.MathUtils.degToRad(orientation[0]-180),
THREE.MathUtils.degToRad(-orientation[1]),
'YZX'
);
bunny.setRotationFromEuler(rotationEuler);