From 2a394a3652ae024d54078e93f4047f3fef970872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Re=CC=81my=20Bouquet?= Date: Wed, 18 Jul 2018 12:40:10 +0200 Subject: [PATCH] Fixes 0 division when camera is aligne on the x axis --- sources/osgGA/OrbitManipulator.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sources/osgGA/OrbitManipulator.js b/sources/osgGA/OrbitManipulator.js index 7d776ed49..d1953005d 100644 --- a/sources/osgGA/OrbitManipulator.js +++ b/sources/osgGA/OrbitManipulator.js @@ -251,6 +251,9 @@ utils.createPrototypeObject( return function(dx, dy) { var prevPitch = Math.atan(-this._rotation[6] / this._rotation[5]); + if (isNaN(prevPitch)) { + prevPitch = 0.0; + } var pitch = this._computePitch(prevPitch, dy); var deltaYaw = dx / 10.0;