Пример #1
0
 def __calcAimOffset(self, aimLocalTransform = None):
     worldCrosshair = Matrix(self.__crosshairMatrix)
     aimingSystemMatrix = self.__aimingSystem.matrix
     if aimLocalTransform is not None:
         worldCrosshair.postMultiply(aimLocalTransform)
     worldCrosshair.postMultiply(aimingSystemMatrix)
     aimOffset = cameras.projectPoint(worldCrosshair.translation)
     return Vector2(mathUtils.clamp(-0.95, 0.95, aimOffset.x), mathUtils.clamp(-0.95, 0.95, aimOffset.y))
 def __calcAimOffset(self, aimLocalTransform=None):
     aimingSystemMatrix = self.__aimingSystem.matrix
     worldCrosshair = Matrix(self.__crosshairMatrix)
     if aimLocalTransform is not None:
         worldCrosshair.postMultiply(aimLocalTransform)
     worldCrosshair.postMultiply(aimingSystemMatrix)
     aimOffset = cameras.projectPoint(worldCrosshair.translation)
     return Vector2(math_utils.clamp(-0.95, 0.95, aimOffset.x), math_utils.clamp(-0.95, 0.95, aimOffset.y))
Пример #3
0
 def __getAnchorPositionData(self, slotId, region):
     if self._tabIndex in C11nTabs.REGIONS:
         anchorPos = self.service.getPointForRegionLeaderLine(region)
         anchorNorm = anchorPos
     else:
         anchorPos = self.service.getPointForAnchorLeaderLine(slotId.areaId, slotId.slotId, slotId.regionId)
         anchorNorm = self.service.getNormalForAnchorLeaderLine(slotId.areaId, slotId.slotId, slotId.regionId)
     return None if anchorPos is None or anchorNorm is None else AnchorPositionData(
         cameras.get2DAngleFromCamera(anchorNorm), cameras.projectPoint(anchorPos), slotId)
Пример #4
0
 def __calculateAimOffset(self, aimWorldPos):
     replayCtrl = BattleReplay.g_replayCtrl
     if replayCtrl.isPlaying and replayCtrl.isControllingCamera:
         aimOffset = replayCtrl.getAimClipPosition()
     else:
         aimOffset = cameras.projectPoint(aimWorldPos)
         aimOffset = Vector2(mathUtils.clamp(-0.95, 0.95, aimOffset.x), mathUtils.clamp(-0.95, 0.95, aimOffset.y))
         if replayCtrl.isRecording:
             replayCtrl.setAimClipPosition(aimOffset)
     return aimOffset
Пример #5
0
 def __calcAimOffset(self, aimLocalTransform=None):
     player = BigWorld.player()
     vehicle = player.getVehicleAttached()
     if self.__isRemoteCamera and vehicle is not None:
         aimingSystemMatrix = self.__getRemoteAim(False)
         aimingSystemMatrix.invert()
     else:
         aimingSystemMatrix = self.__aimingSystem.matrix
     worldCrosshair = Matrix(self.__crosshairMatrix)
     if aimLocalTransform is not None:
         worldCrosshair.postMultiply(aimLocalTransform)
     worldCrosshair.postMultiply(aimingSystemMatrix)
     aimOffset = cameras.projectPoint(worldCrosshair.translation)
     return Vector2(mathUtils.clamp(-0.95, 0.95, aimOffset.x),
                    mathUtils.clamp(-0.95, 0.95, aimOffset.y))
Пример #6
0
 def __calculateAimOffset(self, aimWorldPos):
     replayCtrl = BattleReplay.g_replayCtrl
     if replayCtrl.isPlaying and replayCtrl.isControllingCamera:
         aimOffset = replayCtrl.getAimClipPosition()
     else:
         proj = BigWorld.projection()
         aimLocalPos = Matrix(self.__cam.matrix).applyPoint(aimWorldPos)
         if aimLocalPos.z < 0:
             aimLocalPos.z = max(0.0,
                                 proj.nearPlane - _OFFSET_FROM_NEAR_PLANE)
             aimWorldPos = Matrix(
                 self.__cam.invViewMatrix).applyPoint(aimLocalPos)
         aimOffset = cameras.projectPoint(aimWorldPos)
         aimOffset = Vector2(math_utils.clamp(-0.95, 0.95, aimOffset.x),
                             math_utils.clamp(-0.95, 0.95, aimOffset.y))
         if replayCtrl.isRecording:
             replayCtrl.setAimClipPosition(aimOffset)
     return aimOffset
Пример #7
0
    def onStrategicCameraUpdate(self, camera):

        distRange = camera._StrategicCamera__cfg['distRange']
        if not BigWorld._ba_config['spg']['activateCommandersCamera']:
            distRange = list(distRange)
        if distRange[0] < 20:
            distRange[0] = 20
        distRange[1] = 600

        player = BigWorld.player()
        descr = player.vehicleTypeDescriptor

        shotEnd = camera._StrategicCamera__aimingSystem.matrix.translation

        shellVelocity = Math.Vector3(self._shellVelocity)
        shellVelocity.normalise()

        srcMat = Math.Matrix()
        srcMat.setRotateYPR((shellVelocity.yaw, -shellVelocity.pitch, 0))
        shift = srcMat.applyVector(
            Math.Vector3(camera._StrategicCamera__dxdydz.x, 0,
                         -camera._StrategicCamera__dxdydz.y)
        ) * camera._StrategicCamera__curSense

        replayCtrl = BattleReplay.g_replayCtrl
        if replayCtrl.isPlaying and replayCtrl.isControllingCamera:
            aimOffset = replayCtrl.getAimClipPosition()
        else:
            aimWorldPos = camera._StrategicCamera__aimingSystem.matrix.translation
            aimOffset = cameras.projectPoint(aimWorldPos)
            aimOffset = Math.Vector2(aimOffset.x, aimOffset.y)
            if replayCtrl.isRecording:
                replayCtrl.setAimClipPosition(aimOffset)
        camera._StrategicCamera__aimOffset = aimOffset

        shotDescr = BigWorld.player().vehicleTypeDescriptor.shot
        BigWorld.wg_trajectory_drawer().setParams(
            shotDescr['maxDistance'], Math.Vector3(0, -shotDescr['gravity'],
                                                   0), aimOffset)
        curTime = BigWorld.time()
        deltaTime = curTime - camera._StrategicCamera__prevTime
        camera._StrategicCamera__prevTime = curTime

        if replayCtrl.isPlaying:
            if camera._StrategicCamera__needReset != 0:
                if camera._StrategicCamera__needReset > 1:
                    from helpers import isPlayerAvatar
                    if isPlayerAvatar():
                        if player.inputHandler.ctrl is not None:
                            player.inputHandler.ctrl.resetGunMarkers()
                    camera._StrategicCamera__needReset = 0
                else:
                    camera._StrategicCamera__needReset += 1

            if replayCtrl.isControllingCamera:
                camera._StrategicCamera__aimingSystem.updateTargetPos(
                    replayCtrl.getGunRotatorTargetPoint())
            else:
                camera._StrategicCamera__aimingSystem.handleMovement(
                    shift.x, shift.z)
                if shift.x != 0 and shift.z != 0 or camera._StrategicCamera__dxdydz.z != 0:
                    self._StrategicCamera__needReset = 2
        else:
            camera._StrategicCamera__aimingSystem.handleMovement(
                shift.x, shift.z)

        camera._StrategicCamera__camDist -= camera._StrategicCamera__dxdydz.z * float(
            camera._StrategicCamera__curSense)
        maxPivotHeight = (distRange[1] - distRange[0]
                          ) / BigWorld._ba_config['spg']['zoomSpeed']
        camera._StrategicCamera__camDist = mathUtils.clamp(
            0, maxPivotHeight, camera._StrategicCamera__camDist)
        camera._StrategicCamera__cfg[
            'camDist'] = camera._StrategicCamera__camDist
        if camera._StrategicCamera__dxdydz.z != 0 and camera._StrategicCamera__onChangeControlMode is not None and mathUtils.almostZero(
                camera._StrategicCamera__camDist - maxPivotHeight):
            camera._StrategicCamera__onChangeControlMode()
        camera._StrategicCamera__updateOscillator(deltaTime)
        if not camera._StrategicCamera__autoUpdatePosition:
            camera._StrategicCamera__dxdydz = Math.Vector3(0, 0, 0)

        fov = min(6.0 * descr.gun['shotDispersionAngle'], math.pi * 0.5)
        zoomFactor = 1.0 / math.tan(fov * 0.5) / 5.0

        zoomDistance = distRange[0] * zoomFactor
        fovFactor = camera._StrategicCamera__camDist / maxPivotHeight
        fov = fov * (1.0 - fovFactor) + math.radians(20.0) * fovFactor

        cameraOffset = -shellVelocity.scale(zoomDistance)
        cameraPosition = shotEnd + cameraOffset

        collPoint = None if BigWorld._ba_config['spg'][
            'ignoreObstacles'] else BigWorld.wg_collideSegment(
                player.spaceID, shotEnd - shellVelocity.scale(
                    1.0 if shellVelocity.y > 0.0 else distRange[0] *
                    zoomFactor * 0.25), cameraPosition, 128)

        if collPoint is None:
            collPoint = player.arena.collideWithSpaceBB(
                shotEnd, cameraPosition)
            if collPoint is not None:
                collPoint += shellVelocity
        else:
            collPoint = collPoint[0]

        recalculateDist = False
        if collPoint is not None:
            cameraPosition = collPoint
            cameraOffset = cameraPosition - shotEnd
            recalculateDist = True

        if cameraOffset.length > 700.0:
            cameraOffset.normalise()
            cameraOffset = cameraOffset.scale(700.0)
            cameraPosition = shotEnd + cameraOffset
            recalculateDist = True

        trgMat = Math.Matrix()
        trgMat.setTranslate(cameraPosition)

        camera._StrategicCamera__cam.source = srcMat
        camera._StrategicCamera__cam.target.b = trgMat
        camera._StrategicCamera__cam.pivotPosition = Math.Vector3(0, 0, 0)

        delta = self._prevFarPlane - self._prevNearPlane

        BigWorld.projection().nearPlane = max(
            cameraOffset.length - delta * 0.5, 1.0)
        BigWorld.projection().farPlane = max(cameraOffset.length + delta * 0.5,
                                             self._prevFarPlane)
        BigWorld.projection().fov = fov
        BigWorld.player().positionControl.moveTo(shotEnd)

        if BigWorld._ba_config['spg'][
                'alwaysFollowProjectile'] or BigWorld.isKeyDown(
                    self._followProjectileKey):
            if self._trackProjectile:
                time = BigWorld.time() - self._trackProjectileStartTime
                if time > 0:
                    shotDescr = descr.shot
                    gravity = Math.Vector3(0.0, -shotDescr['gravity'], 0.0)
                    shellVelocity = self._trackProjectileVelocity + gravity.scale(
                        time)
                    srcMat.setRotateYPR(
                        (shellVelocity.yaw, -shellVelocity.pitch, 0))
                    camera._StrategicCamera__cam.source = srcMat
                    camera._StrategicCamera__cam.target.b.setTranslate(
                        self._trackProjectileStartPoint +
                        self._trackProjectileVelocity.scale(time) +
                        gravity.scale(time * time * 0.5))
                    BigWorld.projection().fov = math.pi * 0.4

            elif player._PlayerAvatar__projectileMover and self._projectileID in player._PlayerAvatar__projectileMover._ProjectileMover__projectiles:
                shellVelocity = Math.Matrix(
                    self._projectileModel.matrix).applyVector(
                        Math.Vector3(0.0, 0.0, 1.0))
                srcMat.setRotateYPR(
                    (shellVelocity.yaw, -shellVelocity.pitch, 0))
                camera._StrategicCamera__cam.source = srcMat
                camera._StrategicCamera__cam.target.b.setTranslate(
                    self._projectileModel.position)
                BigWorld.projection().fov = math.pi * 0.4

        return 0
Пример #8
0
 def __calcAimOffset(self):
     aimWorldPos = self.__aimingSystem.matrix.applyPoint(
         Vector3(0, -self.__aimingSystem.height, 0))
     aimOffset = cameras.projectPoint(aimWorldPos)
     return Vector2(mathUtils.clamp(-0.95, 0.95, aimOffset.x),
                    mathUtils.clamp(-0.95, 0.95, aimOffset.y))
Пример #9
0
 def __calcAimOffset(self):
     aimWorldPos = self.__aimingSystem.matrix.applyPoint(Vector3(0, -self.__aimingSystem.height, 0))
     aimOffset = cameras.projectPoint(aimWorldPos)
     return Vector2(mathUtils.clamp(-0.95, 0.95, aimOffset.x), mathUtils.clamp(-0.95, 0.95, aimOffset.y))
Пример #10
0
    def onStrategicCameraUpdate(self, camera):
        replayCtrl = BattleReplay.g_replayCtrl


        distRange = camera._StrategicCamera__cfg['distRange'][:]
        if distRange[0] < 20:
            distRange[0] = 20
        distRange[1] = 600


        player = BigWorld.player( )
        descr = player.vehicleTypeDescriptor

        shotEnd = camera._StrategicCamera__aimingSystem.matrix.translation

        shellVelocity = Math.Vector3( self._shellVelocity )
        shellVelocity.normalise( )

        srcMat = Math.Matrix()
        srcMat.setRotateYPR((shellVelocity.yaw, -shellVelocity.pitch, 0))
        shift = srcMat.applyVector(Math.Vector3(camera._StrategicCamera__dxdydz.x, 0, -camera._StrategicCamera__dxdydz.y)) * camera._StrategicCamera__curSense


        if replayCtrl.isPlaying and replayCtrl.isControllingCamera:
            aimOffset = replayCtrl.getAimClipPosition()
        else:
            aimWorldPos = camera._StrategicCamera__aimingSystem.matrix.translation
            aimOffset = cameras.projectPoint(aimWorldPos)
            if replayCtrl.isRecording:
                replayCtrl.setAimClipPosition(Math.Vector2( aimOffset.x, aimOffset.y ))

        camera._StrategicCamera__aimOffsetFunc((aimOffset.x, aimOffset.y))
        shotDescr = BigWorld.player().vehicleTypeDescriptor.shot
        BigWorld.wg_trajectory_drawer().setParams(shotDescr['maxDistance'], Math.Vector3(0, -shotDescr['gravity'], 0), camera._StrategicCamera__aimOffsetFunc())
        curTime = BigWorld.time()
        deltaTime = curTime - camera._StrategicCamera__prevTime
        camera._StrategicCamera__prevTime = curTime

        if replayCtrl.isPlaying:
            if camera._StrategicCamera__needReset != 0:
                if camera._StrategicCamera__needReset > 1:
                    player = BigWorld.player()
                    if player.inputHandler.ctrl is not None:
                        player.inputHandler.ctrl.resetGunMarkers()
                    
                camera._StrategicCamera__needReset = 0
            else:
                camera._StrategicCamera__needReset += 1

            if replayCtrl.isControllingCamera:
                camera._StrategicCamera__aimingSystem.updateTargetPos(replayCtrl.getGunRotatorTargetPoint())
            else:
                camera._StrategicCamera__aimingSystem.handleMovement(shift.x, shift.z)
                if shift.x != 0 and shift.z != 0 or camera._StrategicCamera__dxdydz.z != 0:
                    self._StrategicCamera__needReset = 2
            
        camera._StrategicCamera__aimingSystem.handleMovement(shift.x, shift.z)
        camera._StrategicCamera__camDist -= camera._StrategicCamera__dxdydz.z * float(camera._StrategicCamera__curSense)
        maxPivotHeight = (distRange[1] - distRange[0]) / BigWorld._ba_config['spg']['zoomSpeed']
        camera._StrategicCamera__camDist = mathUtils.clamp(0, maxPivotHeight, camera._StrategicCamera__camDist)
        camera._StrategicCamera__cfg['camDist'] = camera._StrategicCamera__camDist
        if camera._StrategicCamera__dxdydz.z != 0 and camera._StrategicCamera__onChangeControlMode is not None and mathUtils.almostZero(camera._StrategicCamera__camDist - maxPivotHeight):
            camera._StrategicCamera__onChangeControlMode()
        camera._StrategicCamera__updateOscillator(deltaTime)
        if not camera._StrategicCamera__autoUpdatePosition:
            camera._StrategicCamera__dxdydz = Math.Vector3(0, 0, 0)



        fov = min( 6.0 * descr.gun['shotDispersionAngle'], math.pi * 0.5 )
        zoomFactor = 1.0 / math.tan( fov * 0.5 ) / 5.0

        zoomDistance = distRange[0] * zoomFactor
        fovFactor = camera._StrategicCamera__camDist / maxPivotHeight
        fov = fov * (1.0 - fovFactor) + math.radians(20.0) * fovFactor

        cameraOffset = -shellVelocity.scale( zoomDistance )
        cameraPosition = shotEnd + cameraOffset

        collPoint = None if BigWorld._ba_config['spg']['ignoreObstacles'] else BigWorld.wg_collideSegment(player.spaceID, shotEnd - shellVelocity.scale(1.0 if shellVelocity.y > 0.0 else distRange[0] * zoomFactor * 0.25), cameraPosition, 128)

        if collPoint is None:
            collPoint = player.arena.collideWithSpaceBB(shotEnd, cameraPosition)
            if collPoint is not None:
                collPoint += shellVelocity
        else:
            collPoint = collPoint[0]

        recalculateDist = False
        if collPoint is not None:
            cameraPosition = collPoint
            cameraOffset = cameraPosition - shotEnd
            recalculateDist = True

        if cameraOffset.length > 700.0:
            cameraOffset.normalise()
            cameraOffset = cameraOffset.scale(700.0)
            cameraPosition = shotEnd + cameraOffset
            recalculateDist = True

        trgMat = Math.Matrix( )
        trgMat.setTranslate( cameraPosition )

        camera._StrategicCamera__cam.source = srcMat
        camera._StrategicCamera__cam.target.b = trgMat
        camera._StrategicCamera__cam.pivotPosition = Math.Vector3( 0, 0, 0 )

        delta = self._prevFarPlane - self._prevNearPlane

        BigWorld.projection().nearPlane = max( cameraOffset.length - delta * 0.5, 1.0 )
        BigWorld.projection().farPlane = max( cameraOffset.length + delta * 0.5, self._prevFarPlane )
        BigWorld.projection().fov = fov
        BigWorld.player().positionControl.moveTo(shotEnd)

        return 0
Пример #11
0
def StrategicCamera__cameraUpdate(self):
    replayCtrl = BattleReplay.g_replayCtrl

    global gSPGSniperEnabled
    if not gSPGSniperEnabled:
        srcMat = mathUtils.createRotationMatrix((0, -math.pi * 0.49, 0))
        self._StrategicCamera__cam.source = srcMat
        self._StrategicCamera__cam.target.b = self._StrategicCamera__aimingSystem.matrix

        if not replayCtrl.isPlaying:
            BigWorld.projection().nearPlane = self._prevNearPlane
            BigWorld.projection().farPlane = self._prevFarPlane
            BigWorld.projection(
            ).fov = StrategicCamera.StrategicCamera.ABSOLUTE_VERTICAL_FOV
        return oldStrategicCamera__cameraUpdate(self)

    distRange = self._StrategicCamera__cfg['distRange'][:]
    if distRange[0] < 20:
        distRange[0] = 20
    distRange[1] = 600

    player = BigWorld.player()
    descr = player.vehicleTypeDescriptor

    shotEnd = self._StrategicCamera__aimingSystem.matrix.translation

    shellVelocity = Math.Vector3(
        self._StrategicCamera__aimingSystem._shellVelocity)
    shellVelocity.normalise()

    srcMat = Math.Matrix()
    srcMat.setRotateYPR((shellVelocity.yaw, -shellVelocity.pitch, 0))
    shift = srcMat.applyVector(
        Math.Vector3(self._StrategicCamera__dxdydz.x, 0,
                     -self._StrategicCamera__dxdydz.y)
    ) * self._StrategicCamera__curSense

    if replayCtrl.isPlaying and replayCtrl.isControllingCamera:
        aimOffset = replayCtrl.getAimClipPosition()
    else:
        aimWorldPos = self._StrategicCamera__aimingSystem.matrix.applyPoint(
            Math.Vector3(0, 0, 0))
        aimOffset = cameras.projectPoint(aimWorldPos)
        if replayCtrl.isRecording:
            replayCtrl.setAimClipPosition(
                Math.Vector2(aimOffset.x, aimOffset.y))

    self._StrategicCamera__aim.offset((aimOffset.x, aimOffset.y))
    shotDescr = BigWorld.player().vehicleTypeDescriptor.shot
    BigWorld.wg_trajectory_drawer().setParams(
        shotDescr['maxDistance'], Math.Vector3(0, -shotDescr['gravity'], 0),
        self._StrategicCamera__aim.offset())
    curTime = BigWorld.time()
    deltaTime = curTime - self._StrategicCamera__prevTime
    self._StrategicCamera__prevTime = curTime

    if replayCtrl.isPlaying:
        if self._StrategicCamera__needReset != 0:
            if self._StrategicCamera__needReset > 1:
                player = BigWorld.player()
                if player.inputHandler.ctrl is not None:
                    player.inputHandler.ctrl.resetGunMarkers()

            self._StrategicCamera__needReset = 0
        else:
            self._StrategicCamera__needReset += 1

        if replayCtrl.isControllingCamera:
            self._StrategicCamera__aimingSystem.updateTargetPos(
                replayCtrl.getGunRotatorTargetPoint())
        else:
            self._StrategicCamera__aimingSystem.handleMovement(
                shift.x, shift.z)
            if shift.x != 0 and shift.z != 0 or self._StrategicCamera__dxdydz.z != 0:
                self._StrategicCamera__needReset = 2

    self._StrategicCamera__aimingSystem.handleMovement(shift.x, shift.z)
    self._StrategicCamera__camDist -= self._StrategicCamera__dxdydz.z * float(
        self._StrategicCamera__curSense)
    maxPivotHeight = (distRange[1] -
                      distRange[0]) / BigWorld._ba_config['spg']['zoomSpeed']
    self._StrategicCamera__camDist = mathUtils.clamp(
        0, maxPivotHeight, self._StrategicCamera__camDist)
    self._StrategicCamera__cfg['camDist'] = self._StrategicCamera__camDist
    if self._StrategicCamera__dxdydz.z != 0 and self._StrategicCamera__onChangeControlMode is not None and mathUtils.almostZero(
            self._StrategicCamera__camDist - maxPivotHeight):
        self._StrategicCamera__onChangeControlMode()
    self._StrategicCamera__updateOscillator(deltaTime)
    if not self._StrategicCamera__autoUpdatePosition:
        self._StrategicCamera__dxdydz = Math.Vector3(0, 0, 0)

    fov = min(6.0 * descr.gun['shotDispersionAngle'], math.pi * 0.5)
    zoomFactor = 1.0 / math.tan(fov * 0.5) / 5.0

    #old scheme
    #zoomDistance = ( self._StrategicCamera__camDist + distRange[0] ) * zoomFactor

    #new scheme
    zoomDistance = distRange[0] * zoomFactor
    fovFactor = self._StrategicCamera__camDist / maxPivotHeight
    fov = fov * (1.0 - fovFactor) + math.radians(20.0) * fovFactor

    cameraOffset = -shellVelocity.scale(zoomDistance)
    cameraPosition = shotEnd + cameraOffset

    collPoint = None
    collPoint = BigWorld.wg_collideSegment(
        player.spaceID, shotEnd -
        shellVelocity.scale(1.0 if shellVelocity.y > 0.0 else distRange[0] *
                            zoomFactor * 0.25), cameraPosition, 128)

    if collPoint is None:
        collPoint = player.arena.collideWithSpaceBB(shotEnd, cameraPosition)
        if collPoint is not None:
            collPoint += shellVelocity
    else:
        collPoint = collPoint[0]

    recalculateDist = False
    if collPoint is not None:
        cameraPosition = collPoint
        cameraOffset = cameraPosition - shotEnd
        recalculateDist = True

    if cameraOffset.length > 700.0:
        cameraOffset.normalise()
        cameraOffset = cameraOffset.scale(700.0)
        cameraPosition = shotEnd + cameraOffset
        recalculateDist = True

    #if recalculateDist:
    #    self._StrategicCamera__camDist = cameraOffset.length / zoomFactor - distRange[0]

    #bb = BigWorld.player().arena.arenaType.boundingBox
    #cameraPositionClamped = _clampPoint2DInBox2D(bb[0] - Math.Vector2( 50.0, 50.0 ), bb[1] + Math.Vector2( 50.0, 50.0 ), Math.Vector2(cameraPosition.x, cameraPosition.z))

    #if abs( cameraPositionClamped.x - cameraPosition.x ) > 0.1 or abs( cameraPositionClamped.y - cameraPosition.z ) > 0.1:
    #    clampFactor = min( ( cameraPositionClamped.x - shotEnd.x ) / cameraOffset.x if abs( cameraOffset.x ) > 0.001 else 1.0, ( cameraPositionClamped.y - shotEnd.z ) / cameraOffset.z if abs( cameraOffset.z ) > 0.001 else 1.0 )
    #else:
    #    clampFactor = 1.0

    #if clampFactor < 0.99:
    #    cameraOffset *= clampFactor
    #    cameraPosition = shotEnd + cameraOffset
    #    self._StrategicCamera__camDist = cameraOffset.length / zoomFactor - distRange[0]

    trgMat = Math.Matrix()
    trgMat.setTranslate(cameraPosition)

    self._StrategicCamera__cam.source = srcMat
    self._StrategicCamera__cam.target.b = trgMat
    self._StrategicCamera__cam.pivotPosition = Math.Vector3(0, 0, 0)

    delta = self._prevFarPlane - self._prevNearPlane

    BigWorld.projection().nearPlane = max(cameraOffset.length - delta * 0.5,
                                          1.0)
    BigWorld.projection().farPlane = max(cameraOffset.length + delta * 0.5,
                                         self._prevFarPlane)
    BigWorld.projection().fov = fov
    BigWorld.player().positionControl.moveTo(shotEnd)

    #LOG_ERROR( '{0} {1}'.format( cameraPosition, self._StrategicCamera__camDist ) )
    #FLUSH_LOG( )

    return 0