Handle the situation that rotation makes object behind the camera

This commit is contained in:
Star Brilliant 2014-06-11 00:01:45 +08:00
parent eca0f7403d
commit d0e5fd8b90

View File

@ -538,11 +538,13 @@ def ConvertFlashRotation(rotY, rotZ, X, Y, width, height):
except ZeroDivisionError: except ZeroDivisionError:
logging.error('Rotation makes object behind the camera: trZ == %.0f' % trZ); logging.error('Rotation makes object behind the camera: trZ == %.0f' % trZ);
scaleXY = 1 scaleXY = 1
if scaleXY < 0:
scaleXY = -scaleXY
logging.error('Rotation makes object behind the camera: trZ == %.0f < %.0f' % (trZ, FOV));
trX = (trX-width/2)*scaleXY+width/2 trX = (trX-width/2)*scaleXY+width/2
trY = (trY-height/2)*scaleXY+height/2 trY = (trY-height/2)*scaleXY+height/2
if scaleXY < 0:
scaleXY = -scaleXY
outX += 180
outY += 180
logging.error('Rotation makes object behind the camera: trZ == %.0f < %.0f' % (trZ, FOV));
return (trX, trY, WrapAngle(outX), WrapAngle(outY), WrapAngle(outZ), scaleXY*100, scaleXY*100) return (trX, trY, WrapAngle(outX), WrapAngle(outY), WrapAngle(outZ), scaleXY*100, scaleXY*100)