Camera reinit every frame

I am wondering if it’s normal that the camera position and orientation reinit every frame. I have seen plenty of examples that does not have to use this, but I have to set the data every frame.


class CCamera(DirectObject):
    def __init__(self):
        base.camera.reparentTo(render)
        base.camera.setPosHpr(2, -22, 16, 4, -35.5, 2)

        taskMgr.add(self.updateCam, "updateCam")
    # end __init__

    def updateCam(self, task):
        base.camera.setPosHpr(2, -22, 16, 4, -35.5, 2)
        return Task.cont

The setPosHpr in the constructor is useless because of reinit of the camera.

Nope it is not normal :slight_smile: Maybe you are createing multiple instances of CCamera?

Can you show the code where you use the class?

This is normal as long as the camera is under control of the default mouse control. Using the line base.disableMouse() during initialization will make it work as expected.