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

Using the built-in physics system


Panda3D has a built-in physics system that treats its entities as simple particles with masses to which forces may be applied. This physics system is a great amount simpler than a fully featured rigid body one. But it still is enough for cheaply, quickly, and easily creating some nice and simple physics effects.

Getting ready

To be prepared for this recipe, please first follow the steps found in Setting up the game structure found in Chapter 1. Also, the collision detection system of Panda3D will be used, so reading up on it in Using the built-in collision detection system might be a good idea!

How to do it...

The following steps are required to work with Panda3D's built-in physics system:

  1. Edit Application.py and add the required import statements as well as the constructor of the Application class:

    from direct.showbase.ShowBase import ShowBase
    from panda3d.core import *
    from panda3d.physics import *
    
    class Application(ShowBase):
        def __init__(self):
         ...