本文整理汇总了Python中Math.Matrix.setTranslate方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.setTranslate方法的具体用法?Python Matrix.setTranslate怎么用?Python Matrix.setTranslate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Math.Matrix
的用法示例。
在下文中一共展示了Matrix.setTranslate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: decodeHitPoints
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import setTranslate [as 别名]
def decodeHitPoints(encodedPoints, vehicleDescr):
resultPoints = []
maxHitEffectCode = None
for encodedPoint in encodedPoints:
compName, hitEffectCode, startPoint, endPoint = DamageFromShotDecoder.decodeSegment(
encodedPoint, vehicleDescr
)
if startPoint == endPoint:
continue
maxHitEffectCode = max(hitEffectCode, maxHitEffectCode)
hitTester = getattr(vehicleDescr, compName)["hitTester"]
hitTestRes = hitTester.localHitTest(startPoint, endPoint)
if not hitTestRes:
width, height, depth = (hitTester.bbox[1] - hitTester.bbox[0]) / 256.0
directions = [
Math.Vector3(0.0, -height, 0.0),
Math.Vector3(0.0, height, 0.0),
Math.Vector3(-width, 0.0, 0.0),
Math.Vector3(width, 0.0, 0.0),
Math.Vector3(0.0, 0.0, -depth),
Math.Vector3(0.0, 0.0, depth),
]
for direction in directions:
hitTestRes = hitTester.localHitTest(startPoint + direction, endPoint + direction)
if hitTestRes is not None:
break
if hitTestRes is None:
continue
minDist = hitTestRes[0][0]
for i in xrange(1, len(hitTestRes)):
dist = hitTestRes[i][0]
if dist < minDist:
minDist = dist
hitDir = endPoint - startPoint
hitDir.normalise()
rot = Matrix()
rot.setRotateYPR((hitDir.yaw, hitDir.pitch, 0.0))
matrix = Matrix()
matrix.setTranslate(startPoint + hitDir * minDist)
matrix.preMultiply(rot)
effectGroup = DamageFromShotDecoder.__hitEffectCodeToEffectGroup[hitEffectCode]
resultPoints.append(DamageFromShotDecoder.ShotPoint(compName, matrix, effectGroup))
return (maxHitEffectCode, resultPoints)
示例2: findTargets
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import setTranslate [as 别名]
def findTargets(self, actor, source, target):
self.calculatedTargets = []
origin = source.position + Vector3(0, 0.5, 0)
yaw = source.yaw + math.pi / 2.0
basis = Vector3(math.sin(yaw), 0, math.cos(yaw))
left = []
right = []
leftOver = self.maxNodes
victims = []
if hasattr(self, 'victims'):
victims = self.victims
elif self.findTeam == 1:
team = BigWorld.player().team()
for i in team.members.keys():
entity = BigWorld.entity(i)
if entity:
if (entity.position - origin).length < self.maxRange:
victims.append(entity)
entity = BigWorld.player()
if entity:
if (entity.position - origin).length < self.maxRange:
victims.append(entity)
for e in victims:
if e.inWorld:
dpos = e.position - origin
dpos.normalise()
dotp = basis.dot(dpos)
leftOver -= 2
try:
self.calculatedTargets.append(e.model.node('biped Spine'))
except:
self.calculatedTargets.append(e.model.node('Scene Root'))
while leftOver > 0:
m = Matrix()
if leftOver % 2 == 0:
m.setTranslate(self.randomStrike(source, basis, origin, 1))
self.calculatedTargets.append(m)
else:
m.setTranslate(self.randomStrike(source, basis, origin, 0))
self.calculatedTargets.append(m)
leftOver -= 1
示例3: createTranslationMatrix
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import setTranslate [as 别名]
def createTranslationMatrix(translation):
result = Matrix()
result.setTranslate(translation)
return result
示例4: _setMarkerPos
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import setTranslate [as 别名]
def _setMarkerPos(self, handle, pos):
matrix = Matrix()
matrix.setTranslate(pos)
self._parentObj.setMarkerMatrix(handle, matrix)