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 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
Beispiel #4
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 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
 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 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,
            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 #9
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()