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 ...

Get Game Physics Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.