O'Reilly logo

Panda3D 1.6 Game Engine by Dave Mathews

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - adding a sky sphere

We'll be putting the sky sphere in the track class since it's a piece of scenery, technically.

  1. Open TrackClass_01.py.
  2. Resave the file as TrackClass_02.py.
  3. Let's just dive right in, now. Add these two methods to the very bottom of the Track class:
    def setupSkySphere(self):
    self.skySphere = loader.loadModel(
    "../Models/LinearPinkSkySphere.bam")
    self.skySphere.reparentTo(render)
    self.skySphere.setBin('background', 1)
    self.skySphere.setDepthWrite(False)
    self.skySphere.setShaderOff()
    self.skySphere.setAlphaScale(0)
    taskMgr.add(self.skySphereTask, "SkySphere Task")
    return
    def skySphereTask(self, task):
    self.skySphere.setPos(base.camera, 0, 0, 0)
    return task.cont
    
  4. Right beneath the call to setupLight in the __init__

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required