The Model object
The Mesh
class in its current implementation cannot be transformed. All meshes are at origin. We are going to solve this problem by creating a new Model
class. A Model
will contain a Mesh
, a translation, and a rotation. In general, rigid body physics engines do not deal with scale; so we will not add a scale factor to the new Model
class.
Additionally, a Model
might have an optional parent, another model. When a Model
has a parent, the position and rotation stored in the Model
are relative to its parent. This forms a transformation hierarchy. When the parent object moves, all of its children move with it. Our Model
implementation will also track the Axis Aligned Bounding Box (AABB) of the model in local space.
Getting ready
We are going to create a new Model
structure. This new structure represents a Mesh
with some transform attached. Because models can be in a transform hierarchy, we will implement a GetWordMatrix
function that will return the world matrix of the provided...