Beispiel #1
0
 def enable(self, targetPos):
     player = BigWorld.player()
     self.__vehicleTypeDescriptor = player.vehicleTypeDescriptor
     self.__vehicleMProv = player.getOwnVehicleStabilisedMatrix()
     self.__vehiclePrevMat = Matrix(self.__vehicleMProv)
     IAimingSystem.enable(self, targetPos)
     self.__yawLimits = self.__vehicleTypeDescriptor.gun['turretYawLimits']
     self.__pitchLimits = self.__vehicleTypeDescriptor.gun['pitchLimits']
     self.__idealYaw, self.__idealPitch = AimingSystems.getTurretYawGunPitch(self.__vehicleTypeDescriptor, self.__vehicleMProv, targetPos, True)
     self.__idealYaw, self.__idealPitch = self.__clampToLimits(self.__idealYaw, self.__idealPitch)
     currentGunMat = AimingSystems.getPlayerGunMat(self.__idealYaw, self.__idealPitch)
     self.__g_curYaw = currentGunMat.yaw
     self.__g_curPitch = (targetPos - currentGunMat.translation).pitch
     self._matrix.set(currentGunMat)
     self.__idealYaw, self.__idealPitch = self.__worldYawPitchToTurret(self.__g_curYaw, self.__g_curPitch)
     self.__idealYaw, self.__idealPitch = self.__clampToLimits(self.__idealYaw, self.__idealPitch)
     self.__oscillator.reset()
     self.__pitchfilter.reset(currentGunMat.pitch)
     SniperAimingSystem.__activeSystem = self
     vehicle = player.getVehicleAttached()
     if vehicle is not None:
         if hasattr(vehicle.filter, 'placingOnGround') and not vehicle.filter.placingOnGround:
             vehicle.filter.calcPlacedMatrix(True)
             self.__baseMatrix = vehicle.filter.placingMatrix
         else:
             self.__baseMatrix = vehicle.matrix
     return
 def enable(self, targetPos):
     player = BigWorld.player()
     self.__vehicleTypeDescriptor = player.vehicleTypeDescriptor
     self.__vehicleMProv = player.getOwnVehicleStabilisedMatrix()
     self.__vehiclePrevMat = Matrix(self.__vehicleMProv)
     IAimingSystem.enable(self, targetPos)
     self.__yawLimits = self.__vehicleTypeDescriptor.gun['turretYawLimits']
     self.__pitchLimits = self.__vehicleTypeDescriptor.gun['pitchLimits']
     self.__idealYaw, self.__idealPitch = AimingSystems.getTurretYawGunPitch(self.__vehicleTypeDescriptor, self.__vehicleMProv, targetPos, True)
     self.__idealYaw, self.__idealPitch = self.__clampToLimits(self.__idealYaw, self.__idealPitch)
     currentGunMat = AimingSystems.getPlayerGunMat(self.__idealYaw, self.__idealPitch)
     self.__g_curYaw = currentGunMat.yaw
     self.__g_curPitch = (targetPos - currentGunMat.translation).pitch
     self._matrix.set(currentGunMat)
     self.__idealYaw, self.__idealPitch = self.__worldYawPitchToTurret(self.__g_curYaw, self.__g_curPitch)
     self.__idealYaw, self.__idealPitch = self.__clampToLimits(self.__idealYaw, self.__idealPitch)
     self.__oscillator.reset()
     self.__pitchfilter.reset(currentGunMat.pitch)
     SniperAimingSystem.__activeSystem = self
     vehicle = player.getVehicleAttached()
     if vehicle is not None:
         if not vehicle.filter.placingOnGround:
             vehicle.filter.calcPlacedMatrix(True)
             self.__baseMatrix = vehicle.filter.placingMatrix
         else:
             self.__baseMatrix = vehicle.matrix
     return
 def __init__(self):
     IAimingSystem.__init__(self)
     self.__zoom = None
     self.__idealTurretYaw = 0.0
     self.__idealGunPitch = 0.0
     self.__worldYaw = 0.0
     self.__worldPitch = 0.0
     self._vehicleTypeDescriptor = None
     self._vehicleMProv = None
     self.__siegeState = VEHICLE_SIEGE_STATE.DISABLED
     self.__yprDeviationConstraints = Vector3(
         SniperAimingSystem.__STABILIZED_CONSTRAINTS)
     self.__oscillator = Math.PyOscillator(1.0, Vector3(0.0, 0.0, 15.0),
                                           Vector3(0.0, 0.0, 3.5),
                                           self.__yprDeviationConstraints)
     self.__returningOscillator = Math.PyOscillator(
         1.0, Vector3(0.0, 15.0, 15.0), Vector3(0.0, 3.5, 3.5),
         self.__yprDeviationConstraints)
     self.__pitchCompensating = 0.0
     self.__yawLimits = None
     self.__forceFullStabilization = False
     self.__wasAutoRotationEnabled = False
     self.__timeBeyondLimits = 0.0
     self.__playerGunMatFunction = AimingSystems.getPlayerGunMat
     self.__autoRotationEnabled = False
     return
Beispiel #4
0
 def __init__(self, height, yaw):
     IAimingSystem.__init__(self)
     self._matrix = mathUtils.createRotationMatrix((yaw, 0, 0))
     self._planePosition = Vector3(0, 0, 0)
     self.__camDist = 0.0
     self.__height = height
     self.__heightFromPlane = 0.0
 def enable(self, targetPos):
     player = BigWorld.player()
     self.__vehicleTypeDescriptor = player.vehicleTypeDescriptor
     self.__vehicleMProv = player.getOwnVehicleMatrix()
     self.__vehiclePrevMat = Matrix(self.__vehicleMProv)
     IAimingSystem.enable(self, targetPos)
     self.__yawLimits = self.__vehicleTypeDescriptor.gun['turretYawLimits']
     self.__pitchLimits = self.__vehicleTypeDescriptor.gun['pitchLimits']
     self.__idealYaw, self.__idealPitch = getShotAngles(
         self.__vehicleTypeDescriptor, player.getOwnVehicleMatrix(),
         (0.0, 0.0), targetPos, False)
     self.__idealYaw, self.__idealPitch = self.__clampToLimits(
         self.__idealYaw, self.__idealPitch)
     currentGunMat = AimingSystems.getPlayerGunMat(self.__idealYaw,
                                                   self.__idealPitch)
     self.__g_curYaw = currentGunMat.yaw
     self.__g_curPitch = (targetPos - currentGunMat.translation).pitch
     self._matrix.set(currentGunMat)
     self.__idealYaw, self.__idealPitch = self.__worldYawPitchToTurret(
         self.__g_curYaw, self.__g_curPitch)
     self.__idealYaw, self.__idealPitch = self.__clampToLimits(
         self.__idealYaw, self.__idealPitch)
     self.__oscillator.reset()
     self.__pitchfilter.reset(currentGunMat.pitch)
     SniperAimingSystem.__activeSystem = self
 def __init__(self,
              vehicleMProv,
              heightAboveTarget,
              focusRadius,
              aimMatrix,
              anglesRange,
              enableSmartShotPointCalc=True):
     IAimingSystem.__init__(self)
     self.__aimMatrix = aimMatrix
     self.__vehicleMProv = vehicleMProv
     self.__anglesRange = anglesRange
     self.__cursor = BigWorld.ThirdPersonProvider()
     self.__cursor.base = vehicleMProv
     self.__cursor.heightAboveBase = heightAboveTarget
     self.__cursor.focusRadius = focusRadius
     self.__idealMatrix = Math.Matrix(self._matrix)
     self.__shotPointCalculator = ShotPointCalculatorPlanar(
     ) if enableSmartShotPointCalc else None
     self.__worldSpaceAimingWithLimits = _WorldSpaceAimingWithLimits(
         self.__vehicleMProv)
     self._vehicleTypeDescriptor = None
     self.__cachedScanDirection = Vector3(0.0, 0.0, 0.0)
     self.__cachedScanStart = Vector3(0.0, 0.0, 0.0)
     self.__cursorShouldCheckCollisions = True
     return
Beispiel #7
0
 def __init__(self, vehicleMProv, heightAboveTarget, focusRadius, aimMatrix, anglesRange, enableSmartShotPointCalc = True):
     IAimingSystem.__init__(self)
     self.__aimMatrix = aimMatrix
     self.__vehicleMProv = vehicleMProv
     self.__anglesRange = anglesRange
     self.__cursor = BigWorld.ThirdPersonProvider()
     self.__cursor.base = vehicleMProv
     self.__cursor.heightAboveBase = heightAboveTarget
     self.__cursor.focusRadius = focusRadius
     self.__shotPointCalculator = ShotPointCalculatorPlanar() if enableSmartShotPointCalc else None
Beispiel #8
0
 def enable(self, targetPos, playerGunMatFunction=AimingSystems.getPlayerGunMat):
     player = BigWorld.player()
     self.__playerGunMatFunction = playerGunMatFunction
     self.__vehicleTypeDescriptor = player.vehicleTypeDescriptor
     self.__vehicleMProv = player.inputHandler.steadyVehicleMatrixCalculator.outputMProv
     IAimingSystem.enable(self, targetPos)
     self.focusOnPos(targetPos)
     self.__oscillator.reset()
     SniperAimingSystem.__activeSystem = self
     self.__timeBeyondLimits = 0.0
 def __init__(self):
     IAimingSystem.__init__(self)
     self.__idealTurretYaw = 0.0
     self.__idealGunPitch = 0.0
     self.__worldYaw = 0.0
     self.__worldPitch = 0.0
     self.__vehicleTypeDescriptor = None
     self.__vehicleMProv = None
     self.__vehiclePrevMat = None
     self.__yprDeviationConstraints = Vector3(math.pi * 2.1, math.pi / 2 * 0.95, 0.0)
     self.__oscillator = Oscillator(1.0, Vector3(0.0, 0.0, 15.0), Vector3(0.0, 0.0, 3.5), self.__yprDeviationConstraints)
Beispiel #10
0
 def __init__(self, vehicleMProv, heightAboveTarget, focusRadius, aimMatrix, anglesRange, enableSmartShotPointCalc = True):
     IAimingSystem.__init__(self)
     self.__aimMatrix = aimMatrix
     self.__vehicleMProv = vehicleMProv
     self.__anglesRange = anglesRange
     self.__cursor = BigWorld.ThirdPersonProvider()
     self.__cursor.base = vehicleMProv
     self.__cursor.heightAboveBase = heightAboveTarget
     self.__cursor.focusRadius = focusRadius
     self.__idealMatrix = self._matrix
     self.__shotPointCalculator = ShotPointCalculatorPlanar() if enableSmartShotPointCalc else None
     return
Beispiel #11
0
 def __init__(self):
     IAimingSystem.__init__(self)
     self.__idealTurretYaw = 0.0
     self.__idealGunPitch = 0.0
     self.__worldYaw = 0.0
     self.__worldPitch = 0.0
     self.__vehicleTypeDescriptor = None
     self.__vehicleMProv = None
     self.__vehiclePrevMat = None
     self.__yprDeviationConstraints = Vector3(math.pi * 2.1,
                                              math.pi / 2 * 0.95, 0.0)
     self.__oscillator = Oscillator(1.0, Vector3(0.0, 0.0, 15.0),
                                    Vector3(0.0, 0.0, 3.5),
                                    self.__yprDeviationConstraints)
     return
 def enable(self, targetPos, playerGunMatFunction=AimingSystems.getPlayerGunMat):
     player = BigWorld.player()
     vehicle = player.getVehicleAttached()
     if vehicle is not None:
         siegeState = vehicle.siegeState
         self.__siegeState = siegeState if siegeState is not None else VEHICLE_SIEGE_STATE.DISABLED
         self._vehicleTypeDescriptor = vehicle.typeDescriptor
     self.__playerGunMatFunction = playerGunMatFunction
     self._vehicleMProv = player.inputHandler.steadyVehicleMatrixCalculator.outputMProv
     IAimingSystem.enable(self, targetPos)
     self.focusOnPos(targetPos)
     self.__oscillator.reset()
     SniperAimingSystem.__activeSystem = self
     self.__timeBeyondLimits = 0.0
     return
Beispiel #13
0
 def __init__(self, dataSec):
     IAimingSystem.__init__(self)
     self.__idealYaw = 0.0
     self.__idealPitch = 0.0
     self.__g_curPitch = 0.0
     self.__g_curYaw = 0.0
     self.__vehicleTypeDescriptor = None
     self.__vehicleMProv = None
     self.__vehiclePrevMat = None
     self.__yprDeviationConstraints = Vector3(math.pi * 2.1, math.pi / 2.0 * 0.95, 0.0)
     self.__oscillator = Oscillator(1.0, Vector3(0.0, 0.0, 15.0), Vector3(0.0, 0.0, 3.5), self.__yprDeviationConstraints)
     self.__dInputPitch = 0.0
     self.__dInputYaw = 0.0
     self.__pitchfilter = InputFilter()
     self.reloadConfig(dataSec)
Beispiel #14
0
 def __init__(self, dataSec):
     IAimingSystem.__init__(self)
     self.__idealYaw = 0.0
     self.__idealPitch = 0.0
     self.__g_curPitch = 0.0
     self.__g_curYaw = 0.0
     self.__stailizationLimit = math.radians(60.0)
     self.__vehicleTypeDescriptor = None
     self.__vehicleMProv = None
     self.__vehiclePrevMat = None
     self.__yprDeviationConstraints = Vector3(math.pi * 2.1, math.pi / 2.0 * 0.95, 0.0)
     self.__oscillator = Math.PyOscillator(1.0, Vector3(0.0, 0.0, 15.0), Vector3(0.0, 0.0, 3.5), self.__yprDeviationConstraints)
     self.__pitchfilter = InputFilter()
     self.reloadConfig(dataSec)
     self.__pitchCompensating = 0.0
     return
 def enable(self, targetPos):
     player = BigWorld.player()
     self.__vehicleTypeDescriptor = player.vehicleTypeDescriptor
     self.__vehicleMProv = player.getOwnVehicleMatrix()
     self.__vehiclePrevMat = Matrix(self.__vehicleMProv)
     IAimingSystem.enable(self, targetPos)
     player = BigWorld.player()
     desc = player.vehicleTypeDescriptor
     self.__yawLimits = desc.gun['turretYawLimits']
     self.__idealTurretYaw, self.__idealGunPitch = getShotAngles(desc, player.getOwnVehicleMatrix(), (0, 0), targetPos, False)
     self.__idealTurretYaw, self.__idealGunPitch = self.__clampToLimits(self.__idealTurretYaw, self.__idealGunPitch)
     currentGunMat = AimingSystems.getPlayerGunMat(self.__idealTurretYaw, self.__idealGunPitch)
     self.__worldYaw = currentGunMat.yaw
     self.__worldPitch = (targetPos - currentGunMat.translation).pitch
     self._matrix.set(currentGunMat)
     self.__idealTurretYaw, self.__idealGunPitch = self.__worldYawPitchToTurret(self.__worldYaw, self.__worldPitch)
     self.__idealTurretYaw, self.__idealGunPitch = self.__clampToLimits(self.__idealTurretYaw, self.__idealGunPitch)
     self.__oscillator.reset()
 def enable(self, targetPos):
     player = BigWorld.player()
     self.__vehicleTypeDescriptor = player.vehicleTypeDescriptor
     self.__vehicleMProv = player.getOwnVehicleMatrix()
     self.__vehiclePrevMat = Matrix(self.__vehicleMProv)
     IAimingSystem.enable(self, targetPos)
     self.__yawLimits = self.__vehicleTypeDescriptor.gun['turretYawLimits']
     self.__pitchLimits = self.__vehicleTypeDescriptor.gun['pitchLimits']
     self.__idealTurretYaw, self.__idealGunPitch = AimingSystems.getTurretYawGunPitch(self.__vehicleTypeDescriptor, player.getOwnVehicleMatrix(), targetPos, True)
     self.__idealTurretYaw, self.__idealGunPitch = self.__clampToLimits(self.__idealTurretYaw, self.__idealGunPitch)
     currentGunMat = AimingSystems.getPlayerGunMat(self.__idealTurretYaw, self.__idealGunPitch)
     self.__worldYaw = currentGunMat.yaw
     self.__worldPitch = (targetPos - currentGunMat.translation).pitch
     self._matrix.set(currentGunMat)
     self.__idealTurretYaw, self.__idealGunPitch = self.__worldYawPitchToTurret(self.__worldYaw, self.__worldPitch)
     self.__idealTurretYaw, self.__idealGunPitch = self.__clampToLimits(self.__idealTurretYaw, self.__idealGunPitch)
     self.__oscillator.reset()
     SniperAimingSystem.__activeSystem = self
 def __init__(self, dataSec):
     IAimingSystem.__init__(self)
     self.__idealTurretYaw = 0.0
     self.__idealGunPitch = 0.0
     self.__worldYaw = 0.0
     self.__worldPitch = 0.0
     self.__vehicleTypeDescriptor = None
     self.__vehicleMProv = None
     self.__yprDeviationConstraints = Vector3(
         SniperAimingSystem.__STABILIZED_CONSTRAINTS)
     self.__oscillator = Math.PyOscillator(1.0, Vector3(0.0, 0.0, 15.0),
                                           Vector3(0.0, 0.0, 3.5),
                                           self.__yprDeviationConstraints)
     self.__returningOscillator = Math.PyOscillator(
         1.0, Vector3(0.0, 15.0, 15.0), Vector3(0.0, 3.5, 3.5),
         self.__yprDeviationConstraints)
     self.__pitchCompensating = 0.0
     self.__yawLimits = None
     self.__forceFullStabilization = False
     self.__timeBeyondLimits = 0.0
     self.__playerGunMatFunction = AimingSystems.getPlayerGunMat
     return
 def enable(self,
            targetPos,
            playerGunMatFunction=AimingSystems.getPlayerGunMat):
     player = BigWorld.player()
     vehicle = player.getVehicleAttached()
     self.__playerGunMatFunction = playerGunMatFunction
     self.__vehicleTypeDescriptor = player.vehicleTypeDescriptor
     self.__vehicleMProv = player.inputHandler.steadyVehicleMatrixCalculator.outputMProv
     if player.isObserver():
         self.__vehicleMProv = vehicle.matrix
     IAimingSystem.enable(self, targetPos)
     self.__yawLimits = self.__vehicleTypeDescriptor.gun['turretYawLimits']
     if self.__isTurretHasStaticYaw():
         self.__yawLimits = None
     if self.__yawLimits is not None and abs(self.__yawLimits[0] -
                                             self.__yawLimits[1]) < 1e-05:
         self.__yawLimits = None
     self.__idealTurretYaw, self.__idealGunPitch = self.__getTurretYawGunPitch(
         targetPos, True)
     self.__returningOscillator.reset()
     self.__idealTurretYaw, self.__idealGunPitch = self.__clampToLimits(
         self.__idealTurretYaw, self.__idealGunPitch)
     currentGunMat = self.__getPlayerGunMat(self.__idealTurretYaw,
                                            self.__idealGunPitch)
     self.__worldYaw = currentGunMat.yaw
     self.__worldPitch = (targetPos - currentGunMat.translation).pitch
     self.__idealTurretYaw, self.__idealGunPitch = self.__worldYawPitchToTurret(
         self.__worldYaw, self.__worldPitch)
     self.__idealTurretYaw, self.__idealGunPitch = self.__clampToLimits(
         self.__idealTurretYaw, self.__idealGunPitch)
     currentGunMat = self.__getPlayerGunMat(self.__idealTurretYaw,
                                            self.__idealGunPitch)
     self.__worldYaw = currentGunMat.yaw
     self.__worldPitch = currentGunMat.pitch
     self._matrix.set(currentGunMat)
     self.__oscillator.reset()
     SniperAimingSystem.__activeSystem = self
     self.__timeBeyondLimits = 0.0
     return
Beispiel #19
0
 def enable(self, targetPos):
     player = BigWorld.player()
     self.__vehicleTypeDescriptor = player.vehicleTypeDescriptor
     self.__vehicleMProv = player.getOwnVehicleMatrix()
     self.__vehiclePrevMat = Matrix(self.__vehicleMProv)
     IAimingSystem.enable(self, targetPos)
     player = BigWorld.player()
     desc = player.vehicleTypeDescriptor
     self.__yawLimits = desc.gun['turretYawLimits']
     self.__idealTurretYaw, self.__idealGunPitch = getShotAngles(
         desc, player.getOwnVehicleMatrix(), (0, 0), targetPos, False)
     self.__idealTurretYaw, self.__idealGunPitch = self.__clampToLimits(
         self.__idealTurretYaw, self.__idealGunPitch)
     currentGunMat = AimingSystems.getPlayerGunMat(self.__idealTurretYaw,
                                                   self.__idealGunPitch)
     self.__worldYaw = currentGunMat.yaw
     self.__worldPitch = (targetPos - currentGunMat.translation).pitch
     self._matrix.set(currentGunMat)
     self.__idealTurretYaw, self.__idealGunPitch = self.__worldYawPitchToTurret(
         self.__worldYaw, self.__worldPitch)
     self.__idealTurretYaw, self.__idealGunPitch = self.__clampToLimits(
         self.__idealTurretYaw, self.__idealGunPitch)
     self.__oscillator.reset()
 def destroy(self):
     IAimingSystem.destroy(self)
 def destroy(self):
     IAimingSystem.destroy(self)
     SniperAimingSystem.__activeSystem = None
     return
 def destroy(self):
     IAimingSystem.destroy(self)
 def destroy(self):
     IAimingSystem.destroy(self)
     SniperAimingSystem.__activeSystem = None
     return