Ball and Spring Toy
Game Physics with Bespoke Code
Loading...
Searching...
No Matches
CChain Class Reference

The chain. More...

#include <Chain.h>

Inheritance diagram for CChain:
Collaboration diagram for CChain:

Public Member Functions

 CChain (UINT, float, float, float, Vector2)
 Constructor.
 
- Public Member Functions inherited from CBody
virtual ~CBody ()
 Destructor.
 
void DeliverImpulse (float)
 Deliver impulse to body.
 
void Teleport (const Vector2 &)
 Magically teleport body by this amount.
 
void Draw ()
 Draw body.
 

Additional Inherited Members

- Protected Member Functions inherited from CBody
CPointCreatePoint (eSprite, const Vector2 &)
 Create point.
 
CSpringCreateSpring (eSprite, CPoint *, CPoint *, float=1.0f)
 Create spring.
 
- Protected Attributes inherited from CBody
std::vector< CPoint * > m_stdPt
 Vector of pointers to points in this body.
 
std::vector< CSpring * > m_stdSpr
 Vector of pointers to springs.
 
- Static Protected Attributes inherited from CCommon
static Sage::CSpriteRenderer * m_pRenderer = nullptr
 Pointer to the renderer.
 
static CObjectManagerm_pObjectManager = nullptr
 Pointer to the object manager.
 
static eBody m_eCurrentBody = (eBody)0
 Current body type.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ CChain()

CChain::CChain ( UINT n,
float r,
float s,
float a,
Vector2 v )

Make a chain of points in a straight line connected by springs.

Parameters
nNumber of points
rRest length of the springs.
sCoefficient of restitution of the springs.
aOrientation.
vLocation of chain center.
Here is the call graph for this function: