Skip to content

Commit

Permalink
FirstPersonComtroller wrap issue Bug 506
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnBrookes committed Apr 25, 2013
1 parent 58e0b2c commit 68a8bdc
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/away3d/controllers/FirstPersonController.as
Original file line number Diff line number Diff line change
Expand Up @@ -162,22 +162,19 @@ package away3d.controllers

notifyUpdate();

if (_panAngle < 0)
panAngle = (_panAngle % 360) + 360;
else
panAngle = _panAngle % 360;

if (panAngle - _currentPanAngle < -180)
panAngle += 360;
else if (panAngle - _currentPanAngle > 180)
panAngle -= 360;

_currentTiltAngle += (_tiltAngle - _currentTiltAngle)/(steps + 1);
_currentPanAngle += (_panAngle - _currentPanAngle)/(steps + 1);


//snap coords if angle differences are close
if ((Math.abs(tiltAngle - _currentTiltAngle) < 0.01) && (Math.abs(_panAngle - _currentPanAngle) < 0.01)) {

if(Math.abs(_panAngle) > 360) {
if (_panAngle < 0)
panAngle = (_panAngle % 360) + 360;
else
panAngle = _panAngle % 360;
}

_currentTiltAngle = _tiltAngle;
_currentPanAngle = _panAngle;
}
Expand Down

0 comments on commit 68a8bdc

Please sign in to comment.