i have problem with camera movement and i can’t understand what is happening.
i have a task that move the camera each frame:
def update(taks):
self.state.update()
self.updateCamera()
self.update_gui()
return Task.cont
self.taskMgr.add(update , 'update_state')
in updateCamera i calculate the camera target position and update via getPos():
def updateCamera(self):
# define the camera target position
camera_target_position.x += K.deltax
camera_target_position.y = # bla bla bla
camera_target_position.z += K.deltaz
base.camera.setPos(camera_target_position)
now i want to make movement more fluid using interpolation:
def updateCamera(self):
# define the camera target position
camera_target_position.x += K.deltax
camera_target_position.y = # bla bla bla
camera_target_position.z += K.deltaz
if getattr(self, '_has_interpolation', None):
self.iPos.setEndPos(camera_target_position)
else:
self._has_interpolation = "already got interpolation!"
self.iPos = LerpPosInterval(base.camera, 0.1, camera_target_position)
self.iPos.start()
self.iPos.loop()
print 'first call, create new interpolation'
self.iPos.finish()
self.iPos.start()
but with interpolations… i don’t see my scene and i can’t understand why.
if i try to print base.camera.setPos the coordinates are the same (previous a little time to get interpolated)… but i don’t see anything. someone can give me some advice??