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. More... | |
virtual btTypedConstraint * | GetConstraintBase () const =0 |
Get the Bullet constraint that this class encapsulates. 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 bool | HasParamBeenSet (ConstraintParam Param, int Axis) const =0 |
Has the given Param on the Given Axis been set yet. More... | |
virtual bool | IsParamValidOnAxis (ConstraintParam Param, int Axis) const |
Is a certain Parameter valid on a certain axis. More... | |
virtual void | ProtoDeSerialize (const XML::Node &OneNode) |
Take the data stored in an XML and overwrite this instance of this object with it. More... | |
virtual void | ProtoSerialize (XML::Node &CurrentRoot) const |
Convert this class to an XML::Node ready for serialization. More... | |
virtual void | SetParam (ConstraintParam Param, Real Value, int Axis=-1) |
Provides override of constraint parameters. More... | |
virtual AxisList | ValidAngularAxis () const =0 |
Get A list sorted (low to high) of all axis that operate Angularly (that lock sliding/translation) More... | |
virtual AxisList | ValidAxis () const |
Get a sorted (low to high) list of All Valid Axis. More... | |
virtual AxisList | ValidLinearAxis () const =0 |
Get a sorted (low to high) list of all axis that operate linearly (that lock sliding/translation) More... | |
virtual ParamList | ValidParamOnAxis (int Axis) const =0 |
Get a sorted (low to high) list of Parameters that are valid on this Axis. More... | |
virtual ParamList | ValidParams () const |
Get A sorted (low to high) list of Parameters that are valid on all Axis. More... | |
Static Public Member Functions | |
static String | SerializableName () |
Get the name of the the XML tag this class will leave behind as its instances are serialized. More... | |
Protected Member Functions | |
Constraint () | |
No initialization constructor. More... | |
void | SetBodies (RigidProxy *Prox1, RigidProxy *Prox2) |
Sets the Internal Proxy pointers. More... | |
void | SetBodies (RigidProxy *Prox1) |
Sets the Internal Proxy pointers. More... | |
Protected Attributes | |
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 117 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 160 of file constraint.h.
|
protected |
No initialization constructor.
This is protected to prevent creating an instance of this directly.
|
virtual |
Class destructor.
The class destructor.
|
pure virtual |
Get the Bullet constraint that this class encapsulates.
Implemented in Mezzanine::Physics::Generic6DofConstraint, Mezzanine::Physics::HingeConstraint, Mezzanine::Physics::SliderConstraint, Mezzanine::Physics::GearConstraint, Mezzanine::Physics::Point2PointConstraint, and Mezzanine::Physics::ConeTwistConstraint.
|
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.
|
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::HingeConstraint, Mezzanine::Physics::SliderConstraint, Mezzanine::Physics::Point2PointConstraint, and Mezzanine::Physics::GearConstraint.
|
inlinevirtual |
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.
Definition at line 200 of file constraint.h.
|
virtual |
Take the data stored in an XML and overwrite this instance of this object with it.
OneNode | and XML::Node containing the data. |
This should only be run once all the actors have finishes being deserialized. This will fail if the actors it expects are not present.
Reimplemented in Mezzanine::Physics::Generic6DofConstraint, Mezzanine::Physics::HingeConstraint, Mezzanine::Physics::Generic6DofSpringConstraint, Mezzanine::Physics::Point2PointConstraint, Mezzanine::Physics::DualTransformConstraint, and Mezzanine::Physics::GearConstraint.
|
virtual |
Convert this class to an XML::Node ready for serialization.
CurrentRoot | The point in the XML hierarchy that all this vectorw should be appended to. |
This stores each Actor's name and every constraint parameter on each if it has been set. This should allow for looking up the required actors in the Actor Manager. This should also prevent any interference with different values and minimize the size of the serialized version
Reimplemented in Mezzanine::Physics::Generic6DofConstraint, Mezzanine::Physics::HingeConstraint, Mezzanine::Physics::Generic6DofSpringConstraint, Mezzanine::Physics::Point2PointConstraint, Mezzanine::Physics::DualTransformConstraint, and Mezzanine::Physics::GearConstraint.
|
static |
Get the name of the the XML tag this class will leave behind as its instances are serialized.
|
protected |
Sets the Internal Proxy pointers.
|
protected |
Sets the Internal Proxy pointers.
|
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. |
|
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::HingeConstraint, Mezzanine::Physics::SliderConstraint, Mezzanine::Physics::Point2PointConstraint, and Mezzanine::Physics::GearConstraint.
|
inlinevirtual |
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.
Definition at line 186 of file constraint.h.
|
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::HingeConstraint, Mezzanine::Physics::SliderConstraint, Mezzanine::Physics::Point2PointConstraint, and Mezzanine::Physics::GearConstraint.
|
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::HingeConstraint, Mezzanine::Physics::SliderConstraint, Mezzanine::Physics::Point2PointConstraint, and Mezzanine::Physics::GearConstraint.
|
inlinevirtual |
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.
Definition at line 221 of file constraint.h.
|
protected |
The first Collidable this constraint applies to.
Definition at line 124 of file constraint.h.
|
protected |
The second Collidable this constraint applies to.
Definition at line 127 of file constraint.h.