本文整理汇总了Python中AvatarInputHandler.AimingSystems.SniperAimingSystem.SniperAimingSystem.handleMovement方法的典型用法代码示例。如果您正苦于以下问题:Python SniperAimingSystem.handleMovement方法的具体用法?Python SniperAimingSystem.handleMovement怎么用?Python SniperAimingSystem.handleMovement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AvatarInputHandler.AimingSystems.SniperAimingSystem.SniperAimingSystem
的用法示例。
在下文中一共展示了SniperAimingSystem.handleMovement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SniperCamera
# 需要导入模块: from AvatarInputHandler.AimingSystems.SniperAimingSystem import SniperAimingSystem [as 别名]
# 或者: from AvatarInputHandler.AimingSystems.SniperAimingSystem.SniperAimingSystem import handleMovement [as 别名]
#.........这里部分代码省略.........
def applyImpulse(self, position, impulse, reason = ImpulseReason.ME_HIT):
adjustedImpulse, noiseMagnitude = self.__dynamicCfg.adjustImpulse(impulse, reason)
camMatrix = Matrix(self.__cam.matrix)
impulseLocal = camMatrix.applyVector(adjustedImpulse)
impulseAsYPR = Vector3(impulseLocal.x, -impulseLocal.y + impulseLocal.z, 0)
rollPart = self.__dynamicCfg['impulsePartToRoll']
impulseAsYPR.z = -rollPart * impulseAsYPR.x
impulseAsYPR.x *= 1 - rollPart
self.__impulseOscillator.applyImpulse(impulseAsYPR)
self.__applyNoiseImpulse(noiseMagnitude)
def applyDistantImpulse(self, position, impulseValue, reason = ImpulseReason.ME_HIT):
impulse = self.__cam.position - position
distance = impulse.length
if distance < 1.0:
distance = 1.0
impulse.normalise()
if reason == ImpulseReason.OTHER_SHOT and distance <= self.__dynamicCfg['maxShotImpulseDistance']:
impulse *= impulseValue / distance
elif reason == ImpulseReason.SPLASH:
impulse *= impulseValue / distance
elif reason == ImpulseReason.VEHICLE_EXPLOSION and distance <= self.__dynamicCfg['maxExplosionImpulseDistance']:
impulse *= impulseValue / distance
else:
return
self.applyImpulse(position, impulse, reason)
def __applyNoiseImpulse(self, noiseMagnitude):
noiseImpulse = mathUtils.RandomVectors.random3(noiseMagnitude)
self.__noiseOscillator.applyImpulse(noiseImpulse)
def __rotateAndZoom(self, dx, dy, dz):
self.__aimingSystem.handleMovement(*self.__calcYawPitchDelta(dx, dy))
self.__setupZoom(dz)
def __calcYawPitchDelta(self, dx, dy):
return (dx * self.__curSense * (-1 if self.__cfg['horzInvert'] else 1), dy * self.__curSense * (-1 if self.__cfg['vertInvert'] else 1))
def __showVehicle(self, show):
vehicle = BigWorld.entity(BigWorld.player().playerVehicleID)
if vehicle is not None:
vehicle.show(show)
return
def __setupCamera(self, targetPos):
self.__aimingSystem.enable(targetPos)
def __waitVehicle(self):
vehicle = BigWorld.entity(BigWorld.player().playerVehicleID)
if vehicle is not None and vehicle.isStarted:
self.__waitVehicleCallbackId = None
else:
self.__waitVehicleCallbackId = BigWorld.callback(0.1, self.__waitVehicle)
return
self.__showVehicle(False)
return
def __applyZoom(self, zoomFactor):
FovExtended.instance().setFovByMultiplier(1 / zoomFactor)
def __setupZoom(self, dz):
if dz == 0:
return
else:
zooms = self.__cfg['zooms']