TAILIEUCHUNG - Character Animation with Direct3D- P8

Character Animation with Direct3D- P8:This book is primarily aimed at teaching indie and hobby game developers how to create character animation with Direct3D. Also, the seasoned professional game developer may find some interesting things in this book. You will need a solid understanding of the C++ programming language as well as general object-oriented programming skills. | 126 Character Animation with Direct3D That s pretty much all you need for a lightweight physics simulation. Note that there are light-years between a physics engine like this and a proper engine. For example this engine doesn t handle things like object-object collision etc. Next you ll learn how the position of an object is updated and after that the first physics object the particle will be implemented. Position Velocity and Acceleration Next I ll cover the three most basic physical properties of a rigid body its position p its velocity v and its acceleration a. In 3D space the position of an object is described with x y and z coordinates. The velocity of an object is simply how the position is changing over time. In just the same way the acceleration of an object is how the velocity changes over time. The formulas for these behaviors are listed below. Pn P V A t where pn is the new position. vn v a A t where vn is the new velocity. a m In the case of a 3D object these are all described as a 3D vector with an x y and z component. The following code shows an example class that has the m_position m_velocity and the m_acceleration vector. This class implements the formulas above using a constant acceleration class OBJECT public OBJECT imposition D3DXVECT0R3 m_velocity D3DXVECT0R3 m_acceleration D3DXVECT0R3 f void Update float deltaTime lease purchase PDF Split-Merge on to remove this watermark. Chapter 6 Physics Primer 127 m_velocity m_acceleration deltaTime m_position m_velocity deltaTime private D3DXVECTOR3 m_position D3DXVECTOR3 m_velocity D3DXVECTOR3 m_acceleration As you can see the m_position and the m_velocity vectors are initialized to zero while the m_acceleration vector is pointing in the Y-direction with a constant magnitude of one. Figure shows a graph of how the acceleration velocity and position of an object like this change over time. FIGURE Acceleration velocity and position over