This is the base class for all constraints supported. More...
#include <constraint.h>
Public Types | |
typedef std::vector< int > | AxisList |
Used to Store lists of Int Axis for return types. More... | |
typedef std::vector< ConstraintParam > | ParamList |
Used to Store lists of param for return types. | |
Public Member Functions | |
virtual | ~Constraint () |
Class destructor. | |
virtual btTypedConstraint * | _GetConstraintBase () const =0 |
Get the Bullet constraint that this class encapsulates. More... | |
virtual void | EnableConstraint (const Boole Enable) |
Enables or disables this constraint. More... | |
virtual Boole | GetAllowCollisions () const |
Gets whether or not collisions can/will occur between the two constrained bodies. More... | |
virtual UInt32 | GetConstraintID () const |
Gets the unique ID of this constraint. More... | |
virtual String | GetDerivedSerializableName () const =0 |
Gets the most derived serializable name of this Constraint. More... | |
virtual Real | GetParam (ConstraintParam Param, int Axis=-1) const |
Gets value of constraint parameters. More... | |
virtual RigidProxy * | GetProxyA () const |
Gets the first Proxy this constraint applies to. More... | |
virtual RigidProxy * | GetProxyB () const |
Gets the second Proxy this constraint applies to. More... | |
virtual AxisList | GetValidAngularAxes () const =0 |
Get A list sorted (low to high) of all axis that operate Angularly (that lock sliding/translation) More... | |
virtual AxisList | GetValidAxes () const |
Get a sorted (low to high) list of All Valid Axis. More... | |
virtual AxisList | GetValidLinearAxes () const =0 |
Get a sorted (low to high) list of all axis that operate linearly (that lock sliding/translation) More... | |
virtual ParamList | GetValidParams () const |
Get A sorted (low to high) list of Parameters that are valid on all Axis. More... | |
virtual ParamList | GetValidParamsOnAxis (int Axis) const =0 |
Get a sorted (low to high) list of Parameters that are valid on this Axis. More... | |
virtual Boole | HasParamBeenSet (ConstraintParam Param, int Axis) const =0 |
Has the given Param on the Given Axis been set yet. More... | |
virtual Boole | IsConstraintEnabled () const |
Gets whether or not this constraint is enabled. More... | |
virtual Boole | IsParamValidOnAxis (ConstraintParam Param, int Axis) const |
Is a certain Parameter valid on a certain axis. More... | |
virtual void | ProtoDeSerialize (const XML::Node &SelfRoot) |
Take the data stored in an XML Node and overwrite this object with it. More... | |
virtual void | ProtoDeSerializeGlobalOverrides (const XML::Node &SelfRoot) |
Take the data stored in an XML Node and overwrite the global overrides of this object with it. More... | |
virtual void | ProtoDeSerializeInitData (const XML::Node &SelfRoot)=0 |
Take the data stored in an XML Node and initializes a new internal object with it. More... | |
virtual void | ProtoDeSerializeProperties (const XML::Node &SelfRoot) |
Take the data stored in an XML Node and overwrite the properties of this object with it. More... | |
virtual void | ProtoSerialize (XML::Node &ParentNode) const |
Convert this class to an XML::Node ready for serialization. More... | |
virtual void | ProtoSerializeGlobalOverrides (XML::Node &SelfRoot) const |
Convert the global overrides of this class to an XML::Node ready for serialization. More... | |
virtual void | ProtoSerializeInitData (XML::Node &SelfRoot) const =0 |
Convert the data needed to initialize this class to an XML::Node ready for serialization. More... | |
virtual void | ProtoSerializeProperties (XML::Node &SelfRoot) const |
Convert the properties of this class to an XML::Node ready for serialization. More... | |
virtual void | SetAllowCollisions (const Boole Allow) |
Sets whether collisions between the two constrained bodies should occur. More... | |
virtual void | SetParam (ConstraintParam Param, Real Value, int Axis=-1) |
Provides override of constraint parameters. More... | |
Static Public Member Functions | |
static String | GetSerializableName () |
Get the name of the the XML tag the class will leave behind as its instances are serialized. More... | |
Protected Member Functions | |
Constraint (const UInt32 ID, PhysicsManager *Creator) | |
Zero body constructor. More... | |
Constraint (const UInt32 ID, RigidProxy *Prox1, PhysicsManager *Creator) | |
Single body constructor. More... | |
Constraint (const UInt32 ID, RigidProxy *Prox1, RigidProxy *Prox2, PhysicsManager *Creator) | |
Dual body constructor. More... | |
Protected Attributes | |
Boole | AllowCollisions |
Whether or not collisions will be allowed to occure between the constrained bodies. More... | |
UInt32 | ConstraintID |
The unique ID used to identify this constraint. More... | |
Boole | Enabled |
Whether or not the constraint is currently taking effect. More... | |
PhysicsManager * | Manager |
This is a pointer to the physics manager that created and owns this constraint. More... | |
RigidProxy * | ProxA |
The first Collidable this constraint applies to. More... | |
RigidProxy * | ProxB |
The second Collidable this constraint applies to. More... | |
Friends | |
class | PhysicsManager |
This is the base class for all constraints supported.
This class provides the basis for all the other constraints. This is also a virtual class and provides no constraint properties of it's own, thus shouldn't/can't be called on manually.
Any class implementing a this must implement at least these functions to create a minimally functiontal constraint:
It is advisable to re-implement a few more functions as well, these all have implementation writtens in terms of of the function that must be implemented, but the genericity of them may impede performance.
Definition at line 116 of file constraint.h.
typedef std::vector<int> Mezzanine::Physics::Constraint::AxisList |
Used to Store lists of Int Axis for return types.
In general Axis will come in groups of three, such as 0,1,2, or 0,1,2,3,4,5 which could represent X,Y, and Z or multiple grousp of X,Y, and Z. These Axis can represent Linear/Translation or Angular/Rotation information. Some Constraints support values that affect all constraints, this is usually represented a -1.
Definition at line 124 of file constraint.h.
|
protected |
Zero body constructor.
ID | The unique identifier assigned to this constraint. |
Creator | A pointer to the manager that created this constraint. |
|
protected |
Single body constructor.
ID | The unique identifier assigned to this constraint. |
Prox1 | A pointer to the first/only proxy that will be constrained. |
Creator | A pointer to the manager that created this constraint. |
|
protected |
Dual body constructor.
ID | The unique identifier assigned to this constraint. |
Prox1 | A pointer to the first proxy that will be constrained. |
Prox2 | A pointer to the second proxy that will be constrained. |
Creator | A pointer to the manager that created this constraint. |
|
pure virtual |
Get the Bullet constraint that this class encapsulates.
Implemented in Mezzanine::Physics::Generic6DofConstraint, Mezzanine::Physics::SliderConstraint, Mezzanine::Physics::HingeConstraint, Mezzanine::Physics::ConeTwistConstraint, Mezzanine::Physics::Point2PointConstraint, and Mezzanine::Physics::GearConstraint.
|
virtual |
Enables or disables this constraint.
Enable | Whether or not to make this constraint take effect. |
|
virtual |
Gets whether or not collisions can/will occur between the two constrained bodies.
|
virtual |
Gets the unique ID of this constraint.
|
pure virtual |
Gets the most derived serializable name of this Constraint.
Implemented in Mezzanine::Physics::Generic6DofConstraint, Mezzanine::Physics::SliderConstraint, Mezzanine::Physics::HingeConstraint, Mezzanine::Physics::Generic6DofSpringConstraint, Mezzanine::Physics::ConeTwistConstraint, Mezzanine::Physics::Point2PointConstraint, Mezzanine::Physics::GearConstraint, Mezzanine::Physics::UniversalConstraint, and Mezzanine::Physics::Hinge2Constraint.
|
virtual |
Gets value of constraint parameters.
See SetParam() for clarification. Gets information on constraint parameters.
Para,The | parameter to get information for. |
Axis | Optional axis. |
|
virtual |
Gets the first Proxy this constraint applies to.
|
virtual |
Gets the second Proxy this constraint applies to.
|
static |
Get the name of the the XML tag the class will leave behind as its instances are serialized.
|
pure virtual |
Get A list sorted (low to high) of all axis that operate Angularly (that lock sliding/translation)
Implemented in Mezzanine::Physics::Generic6DofConstraint, Mezzanine::Physics::SliderConstraint, Mezzanine::Physics::HingeConstraint, Mezzanine::Physics::ConeTwistConstraint, Mezzanine::Physics::Point2PointConstraint, and Mezzanine::Physics::GearConstraint.
|
virtual |
Get a sorted (low to high) list of All Valid Axis.
This is implemented using ValidLinearAxis and ValidAngularAxis, Derived versions of this class may wish to make a more specialized implementation of this method that doesn't have the overhead of passing around 3 vectors by value.
|
pure virtual |
Get a sorted (low to high) list of all axis that operate linearly (that lock sliding/translation)
Implemented in Mezzanine::Physics::Generic6DofConstraint, Mezzanine::Physics::SliderConstraint, Mezzanine::Physics::HingeConstraint, Mezzanine::Physics::ConeTwistConstraint, Mezzanine::Physics::Point2PointConstraint, and Mezzanine::Physics::GearConstraint.
|
virtual |
Get A sorted (low to high) list of Parameters that are valid on all Axis.
This is implemented using ValidAxis and ValidParamOnAxis, Derived versions of this class may wish to make a more specialized implementation of this method that doesn't have the overhead of passing around many vectors by value and executing slow loops. Most likely all of these constraint Parameter and axis functions could be replaced with some fairly simple switch statements and statically coded values that are specific to the kind of constraint.
|
pure virtual |
Get a sorted (low to high) list of Parameters that are valid on this Axis.
Parameters returned from this will work on the given axis even if they are not valid on any other axis. There is no guarantee that the Parameters will be uniquely stored per an axis. There is no guarantee that changing one parameter will not change another.
Axis | the Axis to check. |
Implemented in Mezzanine::Physics::Generic6DofConstraint, Mezzanine::Physics::SliderConstraint, Mezzanine::Physics::HingeConstraint, Mezzanine::Physics::ConeTwistConstraint, Mezzanine::Physics::Point2PointConstraint, and Mezzanine::Physics::GearConstraint.
|
pure virtual |
Has the given Param on the Given Axis been set yet.
Param | The parameter to Check |
Axis | The Axis on which to check the param |
This will probably have to implement the same logic aas what is in the respective get/setparam function of each constraint http://bulletphysics.com/Bullet/BulletFull/classbtTypedConstraint.html#a11f44dd743b59bc05e25d500456e2559
Implemented in Mezzanine::Physics::Generic6DofConstraint, Mezzanine::Physics::SliderConstraint, Mezzanine::Physics::HingeConstraint, Mezzanine::Physics::ConeTwistConstraint, Mezzanine::Physics::Point2PointConstraint, and Mezzanine::Physics::GearConstraint.
|
virtual |
Gets whether or not this constraint is enabled.
|
virtual |
Is a certain Parameter valid on a certain axis.
Param | The Parameter to Check |
Axis | The Axis to Check |
This is implemented using ValidParamOnAxis, Derived versions of this class may wish to make a more specialized implementation of this method.
|
virtual |
|
virtual |
Take the data stored in an XML Node and overwrite the global overrides of this object with it.
SelfRoot | An XML::Node containing the data to populate this class with. |
|
pure virtual |
Take the data stored in an XML Node and initializes a new internal object with it.
SelfRoot | An XML::Node containing the data to populate this class with. |
Implemented in Mezzanine::Physics::Point2PointConstraint, Mezzanine::Physics::GearConstraint, and Mezzanine::Physics::DualTransformConstraint.
|
virtual |
Take the data stored in an XML Node and overwrite the properties of this object with it.
SelfRoot | An XML::Node containing the data to populate this class with. |
Reimplemented in Mezzanine::Physics::Generic6DofConstraint, Mezzanine::Physics::SliderConstraint, Mezzanine::Physics::HingeConstraint, Mezzanine::Physics::Generic6DofSpringConstraint, Mezzanine::Physics::ConeTwistConstraint, Mezzanine::Physics::Point2PointConstraint, and Mezzanine::Physics::GearConstraint.
|
virtual |
|
virtual |
Convert the global overrides of this class to an XML::Node ready for serialization.
SelfRoot | The root node containing all the serialized data for this instance. |
|
pure virtual |
Convert the data needed to initialize this class to an XML::Node ready for serialization.
SelfRoot | The root node containing all the serialized data for this instance. |
Implemented in Mezzanine::Physics::Point2PointConstraint, Mezzanine::Physics::DualTransformConstraint, and Mezzanine::Physics::GearConstraint.
|
virtual |
Convert the properties of this class to an XML::Node ready for serialization.
SelfRoot | The root node containing all the serialized data for this instance. |
Reimplemented in Mezzanine::Physics::Generic6DofConstraint, Mezzanine::Physics::SliderConstraint, Mezzanine::Physics::HingeConstraint, Mezzanine::Physics::Generic6DofSpringConstraint, Mezzanine::Physics::ConeTwistConstraint, Mezzanine::Physics::Point2PointConstraint, and Mezzanine::Physics::GearConstraint.
|
virtual |
Sets whether collisions between the two constrained bodies should occur.
Allow | Whether or not collisions will be allowed to occure between the constrained bodies. |
|
virtual |
Provides override of constraint parameters.
Parameters such as ERP(Error Reduction Parameter) and CFM(Constraint Force Mixing) can be altered with this function. Optionally provide axis.
Param | The parameter to override. |
Value | The new value for the parameter. |
Axis | Optional axis. |
|
protected |
Whether or not collisions will be allowed to occure between the constrained bodies.
Definition at line 142 of file constraint.h.
|
protected |
The unique ID used to identify this constraint.
Definition at line 139 of file constraint.h.
|
protected |
Whether or not the constraint is currently taking effect.
Definition at line 145 of file constraint.h.
|
protected |
This is a pointer to the physics manager that created and owns this constraint.
Definition at line 136 of file constraint.h.
|
protected |
The first Collidable this constraint applies to.
Definition at line 130 of file constraint.h.
|
protected |
The second Collidable this constraint applies to.
Definition at line 133 of file constraint.h.