How do i make the camera look at and object while its moving?

So, I have this code here and i wanted the camera to look at the panda while it’s moving.

    self.panda = loader.loadModel("models/panda-model")
    self.panda.setPosHpr(-20, 0, 0, 0, 0, 0)
    Sequence(self.panda.posInterval(3, Point3(20, 0, 0))).loop(), -20, 5)

Have you disabled the default camera controller yet? If not, add base.disableMouse() somewhere (or self.disableMouse() in your ShowBase subclass).

Yes, I have but what I’m trying to do is make the camera point at the panda while it is moving without actually reparenting it onto the panda. The panda is moving using posIntervals so I can just use hprIntervals for the camera but it won’t be as efficient. I tried doing

but the hpr doesn’t change when the panda moves

You need to keep calling to keep repositioning the camera as the panda moves. You can use a task to do this:

def cam_control(task):
  return task.cont

self.taskMgr.add(cam_control, "Camera Controller")

Yeah, that works. I just need to play around with it some more to get it perfect but thanks for the help.