-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Game Physics Cookbook
By :
We will create a new Rigidbody subclass that has volume. This class will either be a sphere or a box. Before we make this subclass, we need to slightly modify the Rigidbody class so that we can identify the type of rigidbody we are dealing with.
As we will create a new subclass of Rigidbody, we need a way to differentiate this new class from a particle. We will introduce the HasVolume helper function that will let us know if a rigid body has volume or not.
This class will be a rigidbody that has a shape and some volume. We will also add a type identifier to the Rigidbody class. With this identifier, we will be able to tell if a rigidbody is a particle or if it has some volume.
Follow the mentioned steps to add type information to the Rigidbody class:
Rigidbody.h. These constants will let us know what type of rigidbody each rigidbody subclass is:#define RIGIDBODY_TYPE_BASE 0 #define RIGIDBODY_TYPE_PARTICLE...