本文整理汇总了Python中Math.Matrix.applyVector方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.applyVector方法的具体用法?Python Matrix.applyVector怎么用?Python Matrix.applyVector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Math.Matrix
的用法示例。
在下文中一共展示了Matrix.applyVector方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __update
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import applyVector [as 别名]
def __update(self, dx, dy, dz, rotateMode = True, zoomMode = True, isCallback = False):
prevPos = self.__inputInertia.calcWorldPos(self.__aimingSystem.matrix)
distChanged = False
if zoomMode and dz != 0:
prevDist = self.__aimingSystem.distanceFromFocus
distDelta = dz * float(self.__curScrollSense)
distMinMax = self.__cfg['distRange']
newDist = mathUtils.clamp(distMinMax.min, distMinMax.max, prevDist - distDelta)
if abs(newDist - prevDist) > 0.001:
self.__aimingSystem.distanceFromFocus = newDist
self.__userCfg['startDist'] = newDist
self.__inputInertia.glideFov(self.__calcRelativeDist())
self.__aimingSystem.aimMatrix = self.__calcAimMatrix()
distChanged = True
changeControlMode = prevDist == newDist and mathUtils.almostZero(newDist - distMinMax.min)
if changeControlMode and self.__onChangeControlMode is not None:
self.__onChangeControlMode()
return
if rotateMode:
self.__updateAngles(dx, dy)
if ENABLE_INPUT_ROTATION_INERTIA and not distChanged:
self.__aimingSystem.update(0.0)
if ENABLE_INPUT_ROTATION_INERTIA or distChanged:
worldDeltaPos = prevPos - self.__aimingSystem.matrix.translation
matInv = Matrix(self.__aimingSystem.matrix)
matInv.invert()
self.__inputInertia.glide(matInv.applyVector(worldDeltaPos))
return
示例2: applyImpulse
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import applyVector [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)
示例3: __calcCurOscillatorAcceleration
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import applyVector [as 别名]
def __calcCurOscillatorAcceleration(self, deltaTime):
vehicle = BigWorld.player().vehicle
if vehicle is None:
return Vector3(0, 0, 0)
curVelocity = vehicle.filter.velocity
relativeSpeed = curVelocity.length / vehicle.typeDescriptor.physics['speedLimits'][0]
if relativeSpeed >= SniperCamera._MIN_REL_SPEED_ACC_SMOOTHING:
self.__accelerationSmoother.maxAllowedAcceleration = self.__dynamicCfg['accelerationThreshold']
else:
self.__accelerationSmoother.maxAllowedAcceleration = self.__dynamicCfg['accelerationMax']
acceleration = self.__accelerationSmoother.update(vehicle, deltaTime)
camMat = Matrix(self.__cam.matrix)
acceleration = camMat.applyVector(-acceleration)
accelSensitivity = self.__dynamicCfg['accelerationSensitivity']
acceleration.x *= accelSensitivity.x
acceleration.y *= accelSensitivity.y
acceleration.z *= accelSensitivity.z
oscillatorAcceleration = Vector3(0, -acceleration.y + acceleration.z, -acceleration.x)
return oscillatorAcceleration
示例4: checkTurretDetachment
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import applyVector [as 别名]
def checkTurretDetachment(self, worldPos):
if self.__vehicle is None:
return
if self.__vehicle.isTurretDetached and not self.__placement == _VehicleBounder.SELECT_DETACHED_TURRET:
turretFound = None
for turret in DetachedTurret.allTurrets:
if turret.vehicleID == self.__vehicle.id and turret.model.visible:
turretFound = turret
break
if turretFound is None:
return
turretToGoalShift = worldPos - turretFound.position
toTurretMat = Matrix(turretFound.matrix)
toTurretMat.invert()
turretToGoalShift = toTurretMat.applyVector(turretToGoalShift)
self.matrix = turretFound.matrix
self.__lookAtProvider = None
self.__placement = _VehicleBounder.SELECT_DETACHED_TURRET
return turretToGoalShift
示例5: update
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import applyVector [as 别名]
def update(self, vehicle, deltaTime):
curVelocity = vehicle.filter.velocity
acceleration = vehicle.filter.acceleration
acceleration = self.__accelerationFilter.add(acceleration)
movementFlags = vehicle.engineMode[1]
moveMask = 3
self.__hasChangedDirection = movementFlags & moveMask ^ self.__prevMovementFlags & moveMask or curVelocity.dot(self.__prevVelocity) <= 0.01
self.__prevMovementFlags = movementFlags
self.__prevVelocity = curVelocity
self.__timeLapsedSinceDirChange += deltaTime
if self.__hasChangedDirection:
self.__timeLapsedSinceDirChange = 0.0
elif self.__timeLapsedSinceDirChange > self.__maxAccelerationDuration:
invVehMat = Matrix(vehicle.matrix)
invVehMat.invert()
accelerationRelativeToVehicle = invVehMat.applyVector(acceleration)
accelerationRelativeToVehicle.x = 0.0
accelerationRelativeToVehicle.z = 0.0
acceleration = Matrix(vehicle.matrix).applyVector(accelerationRelativeToVehicle)
self.__acceleration = acceleration
return acceleration