def setCameraCenterViewDistance(self, center, view='front', distance=10): human = self.selectedHuman tl = animation3d.Timeline(0.20) cam = self.modelCamera if view == 'front': tl.append(animation3d.CameraAction(self.modelCamera, None, [center[0], center[1], distance, center[0], center[1], 0, 0, 1, 0])) elif view == 'top': tl.append(animation3d.CameraAction(self.modelCamera, None, [center[0], center[1] + distance, center[2], center[0], center[1], center[2], 0, 0, -1])) elif view == 'left': tl.append(animation3d.CameraAction(self.modelCamera, None, [center[0] - distance, center[1], center[2], center[0], center[1], center[2], 0, 1, 0])) elif view == 'right': tl.append(animation3d.CameraAction(self.modelCamera, None, [center[0] + distance, center[1], center[2], center[0], center[1], center[2], 0, 1, 0])) tl.append(animation3d.PathAction(human, [human.getPosition(), [0.0, 0.0, 0.0]])) tl.append(animation3d.RotateAction(human, human.getRotation(), [0.0, 0.0, 0.0])) tl.append(animation3d.UpdateAction(self)) tl.start()
def mouseRotate(self, event): speed = self.cameraSpeed() human = self.selectedHuman rot = human.getRotation() rot[0] += 0.5 * event.dy * speed rot[1] += 0.5 * event.dx * speed human.setRotation(rot)
def setGlobalCamera(self): human = self.selectedHuman tl = animation3d.Timeline(0.20) cam = self.modelCamera tl.append(animation3d.CameraAction(self.modelCamera, None, [0,0,60, 0,0,0, 0,1,0])) tl.append(animation3d.PathAction(human, [human.getPosition(), [0.0, 0.0, 0.0]])) tl.append(animation3d.RotateAction(human, human.getRotation(), [0.0, 0.0, 0.0])) tl.append(animation3d.UpdateAction(self)) tl.start()
def rotateCamera(self, axis, amount): human = self.selectedHuman rot = human.getRotation() rot[axis] += amount human.setRotation(rot) self.redraw()