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


Python Matrix.setRotateYPR方法代码示例

本文整理汇总了Python中Math.Matrix.setRotateYPR方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.setRotateYPR方法的具体用法?Python Matrix.setRotateYPR怎么用?Python Matrix.setRotateYPR使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Math.Matrix的用法示例。


在下文中一共展示了Matrix.setRotateYPR方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: createSRTMatrix

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

示例2: decodeHitPoints

# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import setRotateYPR [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

示例3: CircularFlyer

# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import setRotateYPR [as 别名]
class CircularFlyer(BigWorld.UserDataObject):

    def __init__(self):
        BigWorld.UserDataObject.__init__(self)
        self.__prevTime = BigWorld.time()
        self.__angularVelocity = 2 * math.pi / self.rotationPeriod
        if not self.rotateClockwise:
            self.__angularVelocity *= -1
        self.__currentAngle = 0.0
        self.__updateCallbackId = None
        self.__model = None
        self.__modelMatrix = None
        self.__sound = None
        BigWorld.loadResourceListBG((self.modelName, self.pixieName), self.__onResourcesLoaded)
        return

    def __del__(self):
        self.__clear()

    def __clear(self):
        if self.__updateCallbackId is not None:
            BigWorld.cancelCallback(self.__updateCallbackId)
        self.__updateCallbackId = None
        if self.__sound is not None:
            self.__sound.stop()
            self.__sound = None
        if self.__model is not None:
            BigWorld.delModel(self.__model)
            self.__model = None
        return

    def __onResourcesLoaded(self, resourceRefs):
        if self.guid not in BigWorld.userDataObjects:
            return
        else:
            self.__clear()
            if self.modelName in resourceRefs.failedIDs:
                return
            try:
                self.__model = resourceRefs[self.modelName]
                self.__modelMatrix = Matrix()
                self.__modelMatrix.setIdentity()
                servo = BigWorld.Servo(self.__modelMatrix)
                self.__model.addMotor(servo)
                BigWorld.addModel(self.__model)
                if self.actionName != '':
                    action = self.__model.action(self.actionName)
                    if action is not None:
                        action()
                if self.pixieName != '' and self.pixieName not in resourceRefs.failedIDs:
                    pixieNode = self.__model.node(self.pixieHardPoint)
                    pixieNode.attach(resourceRefs[self.pixieName])
                if self.soundName != '':
                    self.__sound = SoundGroups.g_instance.playSoundModel(self.__model, self.soundName)
            except:
                LOG_CURRENT_EXCEPTION()
                self.__model = None
                return

            self.__prevTime = BigWorld.time()
            self.__update()
            return

    def __update(self):
        self.__updateCallbackId = None
        self.__updateCallbackId = BigWorld.callback(0.0, self.__update)
        curTime = BigWorld.time()
        dt = curTime - self.__prevTime
        self.__prevTime = curTime
        self.__currentAngle += self.__angularVelocity * dt
        if self.__currentAngle > 2 * math.pi:
            self.__currentAngle -= 2 * math.pi
        elif self.__currentAngle < -2 * math.pi:
            self.__currentAngle += 2 * math.pi
        radialPosition = Vector3(self.radius * math.sin(self.__currentAngle), 0, self.radius * math.cos(self.__currentAngle))
        modelYaw = self.__currentAngle
        if self.rotateClockwise:
            modelYaw += math.pi / 2
        else:
            modelYaw -= math.pi / 2
        localMatrix = Matrix()
        localMatrix.setRotateY(modelYaw)
        localMatrix.translation = radialPosition
        self.__modelMatrix.setRotateYPR((self.yaw, self.pitch, self.roll))
        self.__modelMatrix.translation = self.position
        self.__modelMatrix.preMultiply(localMatrix)
        return
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:89,代码来源:circularflyer.py

示例4: createRTMatrix

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

示例5: createRotationMatrix

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


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