Example #1
0
 def move_and_rotate_camera_to(self, new_pos, new_rot, absolute=True, duration=0):
     if settings.debug_jump: duration = 0
     if duration == 0:
         if absolute:
             self.camera.set_camera_pos(new_pos)
             self.camera.set_camera_rot(new_rot)
         else:
             self.camera.set_rel_camera_pos(new_pos)
             self.camera.set_rel_camera_rot(new_rot)
     else:
         if self.current_interval != None:
             self.current_interval.pause()
         self.fake = NodePath('fake')
         if absolute:
             self.start_pos = self.camera.get_rel_camera_pos()
             self.end_pos = self.camera.get_rel_position_of(new_pos)
             #TODO
             #new_rot = self.camera.get_rel_rotation_of(new_pos)
         nodepath_lerp = LerpQuatInterval(self.fake,
                                          duration=duration,
                                          blendType='easeInOut',
                                          quat = LQuaternion(*new_rot),
                                          startQuat = LQuaternion(*self.camera.get_camera_rot())
                                          )
         func_lerp = LerpFunc(self.do_camera_move_and_rot,
                              fromData=0,
                              toData=1,
                              duration=duration,
                              blendType='easeInOut',
                              name=None)
         parallel = Parallel(nodepath_lerp, func_lerp)
         self.current_interval = parallel
         self.current_interval.start()