Camera

Another easy mistake to make with Panda3D is by positioning the camera wrong. As the viewpoint into the scene, where and how you move the camera might drastically affect how things look. If all you're seeing after putting up a dozen lights is a blank screen, it's possible you've positioned your camera inside one of your models (or underground, etc.) or rotated it the wrong way. Working effectively with the camera involves a lot of trial and error, but the fundamentals of how the camera works itself is pretty simple.

Setting Position and HPR

By default, the camera is controlled by the mouse. If you want to have a different scheme, or are just generally annoyed by how weird and janky it is, you can disable it with:

base.disableMouse()

Now you can manipulate the camera yourself!

To set the position, you can use the following:

self.camera.setPos(x,y,z)

(Keep in mind that y is on a horizontal axis and z is vertical.)

To change the camera's orientation with HPR (heading, pitch, roll), you can use:

self.camera.setHpr(h,p,r)

In terms of HPR, you can think about yaw, pitch, and roll like an airplane; if we think of the airplane as parallel to the horizon, yaw/heading is which direction the airplane points, pitch is how far up/down the airplane can turn, and roll would be the axis on which the airplane can do a barrel roll (so the axis line would be straight down the center line of the airplane).

results matching ""

    No results matching ""