40 #ifndef _physicspoint2pointconstraint_cpp
41 #define _physicspoint2pointconstraint_cpp
43 #include "Physics/point2pointconstraint.h"
44 #include "Physics/physicsmanager.h"
45 #include "Physics/rigidproxy.h"
47 #include "stringtool.h"
50 #include <btBulletDynamicsCommon.h>
80 if( RigidA && RigidB ) {
118 { this->
Point2Point->m_setting.m_impulseClamp = Clamping; }
121 {
return this->
Point2Point->m_setting.m_impulseClamp; }
124 { this->
Point2Point->m_setting.m_damping = Damping; }
143 Results.push_back(Con_Stop_ERP);
145 Results.push_back(Con_Stop_CFM);
153 Results.push_back(-1);
171 return ( (
Con_ERP == Param || Con_Stop_ERP == Param ) && this->
Point2Point->getFlags() & BT_P2P_FLAGS_ERP ) ||
172 ( (
Con_CFM == Param || Con_Stop_CFM == Param ) && this->
Point2Point->getFlags() & BT_P2P_FLAGS_CFM );
186 if( this->
ProxA != NULL ) {
190 if( this->
ProxB != NULL ) {
225 if( !InitDataNode.
Empty() ) {
231 if( !CurrAttrib.
Empty() )
235 if( !CurrAttrib.
Empty() )
239 if( !PivotANode.
Empty() ) {
244 if( !PivotBNode.
Empty() ) {
264 if( !PropertiesNode.
Empty() ) {
266 CurrAttrib = PropertiesNode.
GetAttribute(
"ImpulseClamping");
267 if( !CurrAttrib.
Empty() )
271 if( !CurrAttrib.
Empty() )
275 if( !CurrAttrib.
Empty() )
289 {
return "Point2PointConstraint"; }
std::ostream & operator<<(std::ostream &stream, const Mezzanine::LinearInterpolator< T > &Lint)
Used to Serialize an Mezzanine::LinearInterpolator to a human readable stream.
std::vector< int > AxisList
Used to Store lists of Int Axis for return types.
Attribute AppendAttribute(const Char8 *Name)
Creates an Attribute and puts it at the end of this Nodes attributes.
CFM values adds some small value to the main diagonal on the constraint matrix to prevent degenerate ...
A light-weight handle for manipulating attributes in DOM tree.
virtual Constraint::AxisList GetValidLinearAxes() const
Get a sorted (low to high) list of all axis that operate linearly (that lock sliding/translation) ...
virtual void SetTAU(const Real TAU)
This may be a scalar for how strongly Angular momentum affects linear momemtum.
virtual Constraint::AxisList GetValidAngularAxes() const
Get A list sorted (low to high) of all axis that operate Angularly (that lock sliding/translation) ...
virtual Boole HasParamBeenSet(ConstraintParam Param, int Axis) const
bool Boole
Generally acts a single bit, true or false.
static String GetSerializableName()
Get the name of the the XML tag the class will leave behind as its instances are serialized.
virtual void ProtoDeSerializeInitData(const XML::Node &SelfRoot)
Take the data stored in an XML Node and initializes a new internal object with it.
virtual UInt32 GetProxyID() const
Gets the unique ID of this proxy.
Thrown when the requested identity could not be found.
Node GetFirstChild() const
Get the first child Node of this Node.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
std::ostream & Serialize(std::ostream &Stream, const T &Converted, const String &Indent=String(""))
Convert any class that supports serialization or has a serializer to a string of chars in a stream...
virtual void SetPivotA(const Vector3 &PivotA)
Set offset of the first proxy.
virtual Vector3 GetPivotB() const
Get offset of the second proxy.
Thrown when a version is accessed/parsed/required and it cannot work correctly or is missing...
CollidableProxy * GetProxyByID(const UInt32 ID) const
Gets the CollidableProxy via its ID.
virtual void SetPivotB(const Vector3 &PivotB)
Set offset of the second proxy.
virtual void EnableConstraint(const Boole Enable)
Enables or disables this constraint.
PhysicsManager * Manager
This is a pointer to the physics manager that created and owns this constraint.
This is the base class for all constraints supported.
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
bool Empty() const
Is this storing anything at all?
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...
virtual Real GetTAU() const
Retrieve the Tau Setting.
virtual Real GetDamping() const
Get the current Damping.
float Real
A Datatype used to represent a real floating point number.
The interface for serialization.
Tries to make a point relative to each of two actors match in 3d space, without regard to rotation...
bool SetValue(const Char8 *rhs)
Set the value of this.
virtual void SetImpulseClamping(const Real Clamping)
Set the current impulse clamping on the constraint.
virtual void CreateConstraint(RigidProxy *RigidA, RigidProxy *RigidB, const Vector3 &PivotA, const Vector3 &PivotB)
Creates the internal constraint.
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...
btVector3 GetBulletVector3() const
Gets a Bullet vector3.
A light-weight handle for manipulating nodes in DOM tree.
unsigned int AsUint(unsigned int def=0) const
Attempts to convert the value of the attribute to an unsigned int and returns the results...
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
int AsInt(int def=0) const
Attempts to convert the value of the attribute to an int and returns the results. ...
uint32_t UInt32
An 32-bit unsigned integer.
bool Empty() const
Is this storing anything at all?
virtual void DestroyConstraint()
Destroys the internal constraint.
virtual btRigidBody * _GetPhysicsObject() const
Accessor for the internal rigid body physics proxy.
Real AsReal(Real def=0) const
Attempts to convert the value of the attribute to a Real and returns the results. ...
ConstraintParam
Used by constraints for setting some parameters.
virtual Real GetImpulseClamping() const
get the current impulse clamping value.
virtual void SetDamping(const Real Damping)
Set a resistive force against the constraint, not too dissimilar to from hinge friction or Air resist...
std::istream & DeSerialize(std::istream &Stream, T &Converted)
Deserialize the next xml tag in the stream into a specific in memory class instance.
virtual btTypedConstraint * _GetConstraintBase() const
Get the Bullet constraint that this class encapsulates.
This is a proxy from which rigid body proxys are handled.
std::vector< ConstraintParam > ParamList
Used to Store lists of param for return types.
This is simply a place for storing all the Physics Related functions.
RigidProxy * ProxA
The first Collidable this constraint applies to.
btPoint2PointConstraint * Point2Point
The internal constraint that this class encapsulates.
virtual Vector3 GetPivotA() const
Get offset of the first proxy.
void ProtoDeSerialize(const XML::Node &OneNode)
Take the data stored in an XML and overwrite this instance of this object with it.
This is used to represent a point in space, or a vector through space.
virtual void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
RigidProxy * ProxB
The second Collidable this constraint applies to.
The bulk of the engine components go in this namspace.
std::istream & operator>>(std::istream &stream, Mezzanine::LinearInterpolator< T > &Lint)
Used to de-serialize an Mezzanine::LinearInterpolator from a stream.
virtual void ProtoSerializeInitData(XML::Node &SelfRoot) const
Convert the data needed to initialize this class to an XML::Node ready for serialization.
Point2PointConstraint(const UInt32 ID, RigidProxy *ProxyA, RigidProxy *ProxyB, const Vector3 &PivotA, const Vector3 &PivotB, PhysicsManager *Creator)
Double body constructor. Binds the two bodies.
virtual ~Point2PointConstraint()
Class destructor.
ERP values adjust how fast the errors in the constraints are reduced.
void SerializeError(const String &FailedTo, const String &ClassName, Boole SOrD)
Simply does some string concatenation, then throws an Exception.
Node AppendChild(NodeType Type=NodeElement)
Creates a Node and makes it a child of this one.
virtual String GetDerivedSerializableName() const
Gets the most derived serializable name of this Constraint.
std::string String
A datatype used to a series of characters.
Attribute GetAttribute(const Char8 *Name) const
Attempt to get an Attribute on this Node with a given name.
virtual Constraint::ParamList GetValidParamsOnAxis(int Axis) const
Get a sorted (low to high) list of Parameters that are valid on this Axis.
void ProtoSerialize(XML::Node &CurrentRoot) const
Convert this class to an XML::Node ready for serialization.
Node GetChild(const Char8 *Name) const
Attempt to get a child Node with a given name.