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
Exemple #2
0
 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)