本文整理汇总了Python中Math.Matrix.translation方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.translation方法的具体用法?Python Matrix.translation怎么用?Python Matrix.translation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Math.Matrix
的用法示例。
在下文中一共展示了Matrix.translation方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __pickVehicle
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import translation [as 别名]
def __pickVehicle(self):
if self.__boundVehicleMProv is not None:
return
else:
x, y = GUI.mcursor().position
from AvatarInputHandler import cameras
dir, start = cameras.getWorldRayAndPoint(x, y)
end = start + dir.scale(100000.0)
pos, colldata = collideDynamicAndStatic(start, end, (), 0)
vehicle = None
if colldata is not None:
entity = colldata[0]
from Vehicle import Vehicle
if isinstance(entity, Vehicle):
vehMatProv = entity.matrix
vehMatInv = Matrix(vehMatProv)
vehMatInv.invert()
localPos = vehMatInv.applyPoint(pos)
result = Math.MatrixProduct()
localTransMat = Matrix()
localTransMat.translation = localPos
result.a = localTransMat
result.b = vehMatProv
return result
return
示例2: createSRTMatrix
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import translation [as 别名]
def createSRTMatrix(scale, rotation, translation):
scaleMatrix = Matrix()
scaleMatrix.setScale(scale)
result = Matrix()
result.setRotateYPR(rotation)
result.translation = translation
result.preMultiply(scaleMatrix)
return result
示例3: assembleCompoundModel
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import translation [as 别名]
def assembleCompoundModel(models, position, vehicleDesc):
tank = BigWorld.createCompoundTank()
chassis = BigWorld.ModelLite(models[0])
hull = BigWorld.ModelLite(models[1])
turret = BigWorld.ModelLite(models[2])
gun = BigWorld.ModelLite(models[3])
matrix = Matrix()
matrix.translation = position
tank.attachPart(0, chassis, '', matrix)
tank.attachPart(1, hull, 'V')
tank.attachPart(2, turret, 'HP_turretJoint')
tank.attachPart(3, gun, 'HP_gunJoint')
BigWorld.addModel(tank)
return tank
示例4: __update
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import translation [as 别名]
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)
示例5: createRTMatrix
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import translation [as 别名]
def createRTMatrix(rotation, translation):
result = Matrix()
result.setRotateYPR(rotation)
result.translation = translation
return result
示例6: _createMarker
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import translation [as 别名]
def _createMarker(self, pos, symbol, active = True):
mProv = Matrix()
mProv.translation = pos
return self._parentObj.createMarker(mProv, symbol, active)
示例7: createStaticMarker
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import translation [as 别名]
def createStaticMarker(self, pos, symbol):
mProv = Matrix()
mProv.translation = pos
handle = self.__ownUI.addMarker(mProv, symbol)
return (mProv, handle)
示例8: createStaticMarker
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import translation [as 别名]
def createStaticMarker(self, pos, symbol):
mProv = Matrix()
mProv.translation = pos
handle = self.__battleApp.markersManager.createMarker(mProv, symbol)
return (mProv, handle)