[Solved]Simple camera movement

Hello,

After just playing around, testing, and choosing Panda3D, I want to start some learning.

So, I loaded the panda-walk model that comes with Panda3D, and I wanted to camera to ‘look down’ on the panda, just like an RTS for example.

Now, I have this:

from direct.showbase.ShowBase import ShowBase
from direct.actor.Actor import Actor
 
class MyApp(ShowBase):
 
    def __init__(self):
        ShowBase.__init__(self)
         
        self.camera.setPos(0,0,10)
        #self.camera.setP()

        self.pandaActor = Actor("models/panda-model", {"walk": "models/panda-walk4"})

        self.pandaActor.setPos(0,50,0)
        self.pandaActor.setScale(0.01,0.01,0.01)

        self.pandaActor.reparentTo(self.render)
        
        self.pandaActor.loop("walk")
 
 
app = MyApp()
app.run()

Now, I guess the self.camera.setPos(0,0,10) should put the camera on a 10 units height? But nothing happens, it is just on the same height as the pandaActor. (the pandaActor is indeed 50 units away on the y-axis.)

Thank you in advance.

Before you can move the camera manually, you need to call

self.disableMouse()

to disable the default mouse controls for the camera.

You can move the camera (base.cam) not the camera node (base.camera) with the default mouse control still on.

The manual says to use base.camera, but I never bumped into problems using base.cam.

We don’t endorse using base.cam for camera positioning unless you understand the implications it brings. Even so, you don’t want your camera transformation to be distorted by the default trackball system. Just call disableMouse and use self.camera.

Ok, thank you guys for the explanation.

I don’t know what implications base.cam should or could have, so I won’t use it. But still thanks for the hint, maybe I can look into it if i’m somewhat more expirienced :slight_smile:

Thanks, this is solved.