We address the problem of simulating motion of rigid bodies and articulated rigid bodies with constraints. Our key goal is to explain all necessary aspects of the dynamics theory such that readers can go ahead and implement their own full-featured simulators after they have finished reading this book. The book consists of a theoretical part and an implementation part. The first part describes the complete theory that underlies physical dynamics and simulation and algorithms that lead to the construction of a functional simulator. The second part describes the proposed simulator in greater detail. It also describes a figure library for modelling motion of articulated bodies using constraints. To make the manuscript as accessible to general audience as possible, we do not assume any prior knowledge of simulation and explain the entire theory from the ground up. The book helps video game developers and computer graphics researchers understand existing physics libraries as well as build new ones. Furthermore, the understanding of the theory can be exploited for building new algorithms for controlling motion of humanoid characters using constraints in computer graphics.