Physics System Modification
In the last section of this chapter, we will build a stable Cloth
class. This class contains a set of particles and three spring systems. For the cloth to actually work, we have to call its physics simulation functions every frame. In this section, we will add cloth support to the PhysicsSystem
.
Getting ready
In this section, we will make several modifications to the PhysicsSystem
class to add support for cloth simulation.
How to do it…
Perform the following steps to add cloth support to our physics system:
- Include the
Cloth.h
header file inPhysicsSystem.h
. Add a vector ofCloth
pointers to thePhysicsSystem
class. Add a function to register a new cloth into the vector and a function to clear the vector:// Start of file unchanced #include "Cloth.h" class PhysicsSystem { protected: // Previous member variable declarations unchanged std::vector<Cloth*> cloths; public: // Previous member functions unchanged void AddCloth(Cloth...