Vigilante Game Framework  1.0.0.8
A 2D/3D C++ Game Framework using SFML.
Public Types | Public Member Functions | Protected Types | Protected Attributes | List of all members
VPhysicsJointBase Class Reference

The base class for all types of physics joints. The class itself does not set up the joint itself, but makes it possible to add to the physics world and set properties of one. More...

#include <VPhysicsJoints.h>

Inheritance diagram for VPhysicsJointBase:
VBase VPhysicsAnchorBase VPhysicsGrooveJoint VPhysicsPhaseBase VPhysicsSimpleMotor VPhysicsDampedBase VPhysicsMinMaxBase VPhysicsPinJoint VPhysicsPivotJoint VPhysicsGearJoint VPhysicsRatchetJoint VPhysicsDampedRotarySpring VPhysicsDampedSpring VPhysicsRotaryLimitJoint VPhysicsSlideJoint

Public Types

typedef VBase VSUPERCLASS
 Used to call parent class functions when they are overrided in class.
 

Public Member Functions

 VPhysicsJointBase ()=default
 Default constructor.
 
 VPhysicsJointBase (VPhysicsCPBody *BodyA, VPhysicsCPBody *BodyB)
 
virtual void Destroy () override
 Destroys object and any data that must be destroyed.
 
void Initialise (VPhysicsCPSpace *space)
 
void Deinitialise (VPhysicsCPSpace *space)
 
VPhysicsCPConstraintGetConstraint ()
 
VPhysicsCPBodyGetBodyA ()
 
VPhysicsCPBodyGetBodyB ()
 
void SetMaxForce (float Max)
 
float GetMaxForce ()
 
void SetErrorBias (float Bias)
 
float GetErrorBias ()
 
void SetMaxBias (float Bias)
 
float GetMaxBias ()
 
void SetCollideBodies (bool value)
 
bool DoesCollideBodies ()
 
float GetImpulse ()
 
- Public Member Functions inherited from VBase
virtual void Kill ()
 
virtual void Revive ()
 Revives the object by setting both alive and exists back to true.
 
virtual void Update (float dt)
 
virtual void Draw (sf::RenderTarget &RenderTarget)
 

Protected Types

enum  VPhysicsJointType {
  PIN, SLIDE, PIVOT, GROOVE,
  DAMPED, DAMPEDROTARY, ROTARYLIMIT, RATCHET,
  GEAR, SIMPLEMOTOR, NUMJOINTTYPES
}
 The types of Physics joints that can be set.
 

Protected Attributes

unsigned int type = -1
 The Type of joint the object is. Used for Get/Set function calls.
 
VPhysicsCPConstraintconstraint = NULL
 The constraint object.
 

Additional Inherited Members

- Static Public Member Functions inherited from VBase
static const wchar_t * VString (const char *fmt,...)
 
static void VLog (const char *fmt,...)
 
static void VLogError (const char *fmt,...)
 
static void VClearLog ()
 
- Public Attributes inherited from VBase
bool active = true
 Base can be updated using Update if true.
 
bool visible = true
 Base can be rendered using Draw if true.
 
bool alive = true
 Helper member that is mainly used filter out behaviours to objects which aren't alive in the scene.
 
bool exists = true
 Base can be updated and rendered if true, else it would no longer be treated as being part of the scene.
 
VType type = NONE
 Base object type, typically set in the constructor of an inherited object to specify what type it is.
 
uint32_t RefCount = 0
 Counts the amount of times the object is referenced in groups, ensures an object is only destroyed when no longer part of a single group.
 

Detailed Description

The base class for all types of physics joints. The class itself does not set up the joint itself, but makes it possible to add to the physics world and set properties of one.

Constructor & Destructor Documentation

◆ VPhysicsJointBase()

VPhysicsJointBase::VPhysicsJointBase ( VPhysicsCPBody BodyA,
VPhysicsCPBody BodyB 
)
Parameters
BodyAThe first physics body to apply the joint to.
BodyBThe second physics body to apply the joint to.

Member Function Documentation

◆ Deinitialise()

void VPhysicsJointBase::Deinitialise ( VPhysicsCPSpace space)

Deinitises and removes the physics joint from the world.

Parameters
spaceThe physics space to remove the joint from.

◆ DoesCollideBodies()

bool VPhysicsJointBase::DoesCollideBodies ( )
Returns
When two bodies collide, Chipmunk ignores the collisions if this property is set to false on any constraint that connects the two bodies. Defaults to true. This can be used to create a chain that self collides, but adjacent links in the chain do not collide.

◆ GetBodyA()

VPhysicsCPBody* VPhysicsJointBase::GetBodyA ( )
Returns
The first body in the joint.

◆ GetBodyB()

VPhysicsCPBody* VPhysicsJointBase::GetBodyB ( )
Returns
The second body in the joint.

◆ GetConstraint()

VPhysicsCPConstraint* VPhysicsJointBase::GetConstraint ( )
Returns
The constraint that makes up the joint.

◆ GetErrorBias()

float VPhysicsJointBase::GetErrorBias ( )
Returns
The percentage of joint error that remains unfixed after a second. This works exactly the same as the collision bias property of a space, but applies to fixing error (stretching) of joints instead of overlapping collisions.

◆ GetImpulse()

float VPhysicsJointBase::GetImpulse ( )
Returns
The most recent impluse that has been applied. Divide by the timestep to get the force.

◆ GetMaxBias()

float VPhysicsJointBase::GetMaxBias ( )
Returns
The maximum speed at which the constraint can apply error correction. Defaults to INFINITY.

◆ GetMaxForce()

float VPhysicsJointBase::GetMaxForce ( )
Returns
The maximum force that the constraint can use to act on the two bodies. Defaults to INFINITY.

◆ Initialise()

void VPhysicsJointBase::Initialise ( VPhysicsCPSpace space)

Initialises the physics joint.

Parameters
spaceThe physics space to initialise the joint to.

◆ SetCollideBodies()

void VPhysicsJointBase::SetCollideBodies ( bool  value)
Parameters
valueWhen two bodies collide, Chipmunk ignores the collisions if this property is set to false on any constraint that connects the two bodies. Defaults to true. This can be used to create a chain that self collides, but adjacent links in the chain do not collide.

◆ SetErrorBias()

void VPhysicsJointBase::SetErrorBias ( float  Bias)
Parameters
BiasThe percentage of joint error that remains unfixed after a second. This works exactly the same as the collision bias property of a space, but applies to fixing error (stretching) of joints instead of overlapping collisions.

◆ SetMaxBias()

void VPhysicsJointBase::SetMaxBias ( float  Bias)
Parameters
BiasThe maximum speed at which the constraint can apply error correction. Defaults to INFINITY.

◆ SetMaxForce()

void VPhysicsJointBase::SetMaxForce ( float  Max)
Parameters
MaxThe maximum force that the constraint can use to act on the two bodies. Defaults to INFINITY.

The documentation for this class was generated from the following file: