![]() |
Box2D Joint Toy
Ian Parberry's "Introduction to Game Physics"
|
The windmill class. More...
#include <Windmill.h>
Public Member Functions | |
| CWindmill (float, float) | |
| Constructor. More... | |
| void | reverse () |
| Reverse motor. More... | |
Private Member Functions | |
| b2Body * | CreateBlade (float, float) |
| Create the blades. More... | |
| b2Body * | CreateBase (float, float) |
| Create the base. More... | |
Private Attributes | |
| b2RevoluteJoint * | m_pJoint = nullptr |
| Pointer to revolute joint. | |
Additional Inherited Members | |
Static Protected Attributes inherited from CCommon | |
| static b2World * | m_pPhysicsWorld = nullptr |
| Pointer to Box2D Physics World. | |
| static CRenderer * | m_pRenderer = nullptr |
| Pointer to the renderer. | |
| static CObjectManager * | m_pObjectManager = nullptr |
| Pointer to the object manager. | |
| static CWindmill * | m_pWindmill = nullptr |
| Pointer to windmill. | |
| static CGear * | m_pGear = nullptr |
| Pointer to gear system. | |
| static CNautilusGear * | m_pNautilusGear = nullptr |
| Pointer to Nautilus gear system. | |
| static CRackAndPinion * | m_pRackAndPinion = nullptr |
| Pointer to rack-and-pinion. | |
| static CCar * | m_pCar = nullptr |
| Pointer to car. | |
| static CRamp * | m_pRamp = nullptr |
| Pointer to ramp. | |
| static CNewtonsCradle * | m_pNewtonsCradle = nullptr |
| Pointer to Newton's Cradle. | |
| static CPulley * | m_pPulley = nullptr |
| Pointer to pulley system. | |
| static eLevel | m_eCurLevel = eLevel::Windmill |
| Current level. | |
The windmill class.
A windmill with the vanes propelled by a revolute joint with a motor.
| CWindmill::CWindmill | ( | float | x, |
| float | y | ||
| ) |
Constructor.
Create physics bodies for the windmill's blades and base, and a rotational joint between them.
| x | X coordinate in Physics World units. |
| y | Y coordinate in Physics World units. |
|
private |
Create the base.
Create a physics body for the windmill base in Physics World.
| x | X coordinate in Physics World units. |
| y | Y coordinate in Physics World units. |
|
private |
Create the blades.
Create a physics body for the windmill blades in Physics World.
| x | X coordinate in Physics World units. |
| y | Y coordinate in Physics World units. |
| void CWindmill::reverse | ( | ) |
Reverse motor.
Reverse the windmill by setting the motor speed on the revolute joint.