Book Image

Panda3D 1.7 Game Developer's Cookbook

Book Image

Panda3D 1.7 Game Developer's Cookbook

Overview of this book

Table of Contents (20 chapters)
Panda3D 1.7 Game Developer's Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Making objects reflect the scene


This recipe will show you how to enable and use cube mapping to make your models and actors dynamically reflect any other game objects and the surrounding environment. This is a very useful effect for emphasizing movement by creating a glossy car paint effect in a racing game, for example.

Getting ready

This recipe requires you to have finished the steps of the recipe Setting up the game structure found in Chapter 1 and will follow up to where this recipe left off.

How to do it...

These are the tasks for this recipe:

  1. In the file Application.py, add the following code:

    from direct.showbase.ShowBase import ShowBase
    from panda3d.core import *
    from direct.interval.IntervalGlobal import *
    
    class Application(ShowBase):
        def __init__(self):
            ShowBase.__init__(self)
    
            self.world = loader.loadModel("environment")
            self.world.reparentTo(render)
            self.world.setScale(0.5)
            self.world.setPos(-8, 80, 0)
    
            self.teapot = loader.loadModel...