40 #ifndef _physicsgearconstraint_cpp
41 #define _physicsgearconstraint_cpp
43 #include "Physics/gearconstraint.h"
44 #include "Physics/physicsmanager.h"
45 #include "Physics/rigidproxy.h"
47 #include "stringtool.h"
50 #include <btBulletDynamicsCommon.h>
73 if( this->
Gear == NULL ) {
81 if( this->
Gear != NULL ) {
108 { this->
Gear->setRatio(Ratio); }
111 {
return this->
Gear->getRatio(); }
150 if( this->
ProxA != NULL ) {
154 if( this->
ProxB != NULL ) {
187 if( !InitDataNode.
Empty() ) {
193 if( !CurrAttrib.
Empty() )
197 if( !CurrAttrib.
Empty() )
201 if( !AxisANode.
Empty() ) {
206 if( !AxisBNode.
Empty() ) {
226 if( !PropertiesNode.
Empty() ) {
228 CurrAttrib = PropertiesNode.
GetAttribute(
"RotationRatio");
229 if( !CurrAttrib.
Empty() )
243 {
return "GearConstraint"; }
249 {
return this->
Gear; }
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.
A light-weight handle for manipulating attributes in DOM tree.
virtual Vector3 GetAxisB() const
Gets the axis in ActorB's local space which will be manipulated.
bool Boole
Generally acts a single bit, true or false.
virtual Constraint::AxisList GetValidLinearAxes() const
Get a sorted (low to high) list of all axis that operate linearly (that lock sliding/translation) ...
virtual void SetRotationRatio(const Real Ratio)
Sets the ratio at which ActorA's rotation will be applied to ActorB.
virtual UInt32 GetProxyID() const
Gets the unique ID of this proxy.
Thrown when the requested identity could not be found.
virtual void ProtoSerializeInitData(XML::Node &SelfRoot) const
Convert the data needed to initialize this class to an XML::Node ready for serialization.
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.
virtual void CreateConstraint(RigidProxy *RigidA, RigidProxy *RigidB, const Vector3 &AxisA, const Vector3 &AxisB)
Creates the internal constraint.
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 ProtoDeSerializeInitData(const XML::Node &SelfRoot)
Take the data stored in an XML Node and initializes a new internal object with it.
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 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 SetAxisA(const Vector3 &Axis)
Sets the axis in ActorA's local space which will translate to ActorB.
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 Boole HasParamBeenSet(ConstraintParam Param, int Axis) const
virtual Constraint::ParamList GetValidParamsOnAxis(int Axis) const
Get a sorted (low to high) list of Parameters that are valid on this Axis.
virtual void SetAxisB(const Vector3 &Axis)
Sets the axis in ActorB's local space which will be manipulated.
float Real
A Datatype used to represent a real floating point number.
GearConstraint(const UInt32 ID, RigidProxy *ProxyA, RigidProxy *ProxyB, const Vector3 &AxisA, const Vector3 &AxisB, PhysicsManager *Creator)
Double body constructor. Binds the two bodies.
The interface for serialization.
virtual ~GearConstraint()
Class destructor.
bool SetValue(const Char8 *rhs)
Set the value of this.
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 void DestroyConstraint()
Destroys the internal constraint.
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...
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.
btGearConstraint * Gear
Bullet constraint that this class encapsulates.
bool Empty() const
Is this storing anything at all?
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 Constraint::AxisList GetValidAngularAxes() const
Get A list sorted (low to high) of all axis that operate Angularly (that lock sliding/translation) ...
static String GetSerializableName()
Get the name of the the XML tag the class will leave behind as its instances are serialized.
virtual Real GetRotationRatio() const
Gets the ratio at which ActorA's rotation will be applied to ActorB.
This is a proxy from which rigid body proxys are handled.
std::vector< ConstraintParam > ParamList
Used to Store lists of param for return types.
virtual btTypedConstraint * _GetConstraintBase() const
Get the Bullet constraint that this class encapsulates.
virtual Vector3 GetAxisA() const
Gets the axis in ActorA's local space which will translate to ActorB.
This is simply a place for storing all the Physics Related functions.
RigidProxy * ProxA
The first Collidable this constraint applies to.
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.
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
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.
std::string String
A datatype used to a series of characters.
virtual String GetDerivedSerializableName() const
Gets the most derived serializable name of this Constraint.
Attribute GetAttribute(const Char8 *Name) const
Attempt to get an Attribute on this Node with a given name.
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.