![]() |
Ball and Spring Toy
Ian Parberry's "Introduction to Game Physics"
|
The chain. More...
#include <Chain.h>
Public Member Functions | |
CChain (UINT, float, float, float, Vector2) | |
Constructor. More... | |
![]() | |
void | DeliverImpulse (float) |
Deliver impulse to body. More... | |
void | Teleport (const Vector2 &) |
Magically teleport body by this amount. More... | |
void | draw () |
Draw body. More... | |
Additional Inherited Members | |
![]() | |
CPoint * | CreatePoint (eSprite, const Vector2 &) |
Create point. More... | |
CSpring * | CreateSpring (eSprite, CPoint *, CPoint *, float=1.0f) |
Create spring. More... | |
![]() | |
std::vector< CPoint * > | m_stdPt |
Vector of pointers to points in this body. | |
std::vector< CSpring * > | m_stdSpr |
Vector of pointers to springs. | |
![]() | |
static CRenderer * | m_pRenderer = nullptr |
Pointer to the renderer. | |
static CObjectManager * | m_pObjectManager = nullptr |
Pointer to the object manager. | |
static eBody | m_eCurrentBody = (eBody)0 |
Current body type. | |
A chain is a body consisting of a collection of points laid out in a line with a spring or stick from each one to the next.
CChain::CChain | ( | UINT | n, |
float | r, | ||
float | s, | ||
float | a, | ||
Vector2 | v | ||
) |
Make a chain of points in a straight line connected by springs.
n | Number of points |
r | Rest length of the springs. |
s | Coefficient of restitution of the springs. |
a | Orientation. |
v | Location of chain center. |