Connecting two physics bodies together with a spring. More...
#include <CCPhysicsJoint.h>
Public Member Functions | |
Vec2 | getAnchr1 () const |
void | setAnchr1 (const Vec2 &anchr1) |
Vec2 | getAnchr2 () const |
void | setAnchr2 (const Vec2 &anchr2) |
float | getRestLength () const |
void | setRestLength (float restLength) |
float | getStiffness () const |
void | setStiffness (float stiffness) |
float | getDamping () const |
void | setDamping (float damping) |
virtual bool | createConstraints () override |
![]() | |
PhysicsBody * | getBodyA () const |
PhysicsBody * | getBodyB () const |
PhysicsWorld * | getWorld () const |
int | getTag () const |
void | setTag (int tag) |
bool | isEnabled () const |
void | setEnable (bool enable) |
Enable/Disable the joint. More... | |
bool | isCollisionEnabled () const |
void | setCollisionEnable (bool enable) |
Enable/disable the collision between two bodies. More... | |
void | removeFormWorld () |
Remove the joint from the world. More... | |
void | setMaxForce (float force) |
Set the max force between two bodies. More... | |
float | getMaxForce () const |
Get the max force setting. More... | |
Static Public Member Functions | |
static PhysicsJointSpring * | construct (PhysicsBody *a, PhysicsBody *b, const Vec2 &anchr1, const Vec2 &anchr2, float stiffness, float damping) |
Protected Member Functions | |
PhysicsJointSpring () | |
virtual | ~PhysicsJointSpring () |
![]() | |
PhysicsJoint () | |
virtual | ~PhysicsJoint ()=0 |
bool | init (PhysicsBody *a, PhysicsBody *b) |
bool | initJoint () |
Protected Attributes | |
Vec2 | _anchr1 |
Vec2 | _anchr2 |
float | _stiffness |
float | _damping |
![]() | |
std::vector< cpConstraint * > | _cpConstraints |
PhysicsBody * | _bodyA |
PhysicsBody * | _bodyB |
PhysicsWorld * | _world |
bool | _enable |
bool | _collisionEnable |
bool | _destoryMark |
int | _tag |
float | _maxForce |
bool | _initDirty |
Connecting two physics bodies together with a spring.
|
inlineprotected |
|
inlineprotectedvirtual |
|
static |
|
overridevirtual |
Reimplemented from PhysicsJoint.
Vec2 getAnchr1 | ( | ) | const |
Vec2 getAnchr2 | ( | ) | const |
float getDamping | ( | ) | const |
float getRestLength | ( | ) | const |
float getStiffness | ( | ) | const |
void setAnchr1 | ( | const Vec2 & | anchr1 | ) |
void setAnchr2 | ( | const Vec2 & | anchr2 | ) |
void setDamping | ( | float | damping | ) |
void setRestLength | ( | float | restLength | ) |
void setStiffness | ( | float | stiffness | ) |
|
protected |
|
protected |
|
protected |
|
protected |