示例#1
0
 def __getSlotsPointsByRadius(targetPos, cylinderRadius):
     initMatrix = Math.Matrix(BigWorld.camera().invViewMatrix)
     initDirection = initMatrix.applyToAxis(2)
     startPoint = initMatrix.translation
     xPlanePoint = startPoint + initMatrix.applyToAxis(0)
     zPlanePoint = startPoint + initDirection
     camHorizontalPlane = Math.Plane()
     camHorizontalPlane.init(startPoint, xPlanePoint, zPlanePoint)
     intersectedPoint = camHorizontalPlane.intersectRay(
         targetPos, Math.Vector3(0.0, 1.0, 0.0))
     leftPoint = intersectedPoint - initMatrix.applyToAxis(
         0) * cylinderRadius
     rightPoint = intersectedPoint + initMatrix.applyToAxis(
         0) * cylinderRadius
     return (leftPoint, rightPoint)
 def __calculateCursorCameraParams(targetPos, cameraParams):
     initMatrix = Math.Matrix(cameraParams.initMatrix)
     initDirection = initMatrix.applyToAxis(2)
     startPoint = initMatrix.translation
     xPlanePoint = startPoint + initMatrix.applyToAxis(0)
     zPlanePoint = startPoint + initDirection
     camHorizontalPlane = Math.Plane()
     camHorizontalPlane.init(startPoint, xPlanePoint, zPlanePoint)
     intersectedPoint = camHorizontalPlane.intersectRay(
         targetPos, Math.Vector3(0.0, 1.0, 0.0))
     correctedCamDirection = intersectedPoint - startPoint
     pivotVec = intersectedPoint - targetPos
     pivotY = pivotVec.y
     yawCorrection = correctedCamDirection.yaw - initDirection.yaw
     yawCorrectionMatrix = Math.Matrix()
     yawCorrectionMatrix.setRotateYPR(Math.Vector3(yawCorrection, 0.0, 0.0))
     initMatrix.postMultiply(yawCorrectionMatrix)
     return (pivotY, correctedCamDirection.length, initMatrix.yaw,
             -initMatrix.pitch)
 def __init__(self):
     self.__plane = Math.Plane()
     self.init(Vector3(0, 0, 0), Vector3(0, 0, 0))