当前位置: 首页>>代码示例>>Python>>正文


Python Matrix.setTranslate方法代码示例

本文整理汇总了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)
开发者ID:kblw,项目名称:wot_client,代码行数:48,代码来源:vehicleeffects.py

示例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
开发者ID:webiumsk,项目名称:WOT-0.9.14-CT,代码行数:45,代码来源:aoevictimnodelist.py

示例3: createTranslationMatrix

# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import setTranslate [as 别名]
def createTranslationMatrix(translation):
    result = Matrix()
    result.setTranslate(translation)
    return result
开发者ID:Infernux,项目名称:Projects,代码行数:6,代码来源:mathutils.py

示例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)
开发者ID:aevitas,项目名称:wotsdk,代码行数:6,代码来源:markers2dplugins.py


注:本文中的Math.Matrix.setTranslate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。