Camera Object OOP - ZackWilde27/Z3dPy GitHub Wiki
z3dpy.Camera(x, y, z, screenWidth, screenHeight)
myCamera = z3dpy.Camera(0, 0, 0, 1280, 720)
Camera rotation is determined by it's Target and Up Vector. The rot parameter has no effect in this version.
By default, the Up Vector is up along the y axis, and the target is forward along the Z axis.
Targets
If you want a first person camera, use SetTargetVector(vector)
If you want a third person camera, use SetTargetLocation(vector)
Up vector normally remains the same, but it can also be changed
# Third person camera
myCamera.SetTargetLocation(myCharacter.pos)
# First person camera
# SetTargetVector() takes a normalized vector, meaning it goes from -1 to 1 to indicate direction.
myCamera.SetTargetVector(z3dpy.Vector(0, 0, 1))
You'll need to update the target per frame if the camera's going to move, or it'll continue looking at the same spot.
Other
By default, the fov is 90, the near clip is 0.1, and the farClip is 1500, but these can all be changed:
myCamera.fov = 75
myCamera.nc = 0.5
myCamera.fc = 1200
print(myCamera.fov)
print(myCamera.nc)