40 #ifndef _physicsgeneric6dofspringconstraint_cpp
41 #define _physicsgeneric6dofspringconstraint_cpp
43 #include "Physics/generic6dofspringconstraint.h"
44 #include "Physics/rigidproxy.h"
46 #include "stringtool.h"
49 #include <btBulletDynamicsCommon.h>
78 {
return static_cast<btGeneric6DofSpringConstraint*
>( this->
Generic6dof ); }
262 if( !PropertiesNode.
Empty() ) {
265 for(
XML::NodeIterator LinearAxesNodeIt = LinearAxesNode.
begin() ; LinearAxesNodeIt != LinearAxesNode.
end() ; ++LinearAxesNodeIt )
267 if( !(*LinearAxesNodeIt).Empty() ) {
268 if( (*LinearAxesNodeIt).GetAttribute(
"Version").AsInt() == 1 ) {
271 CurrAttrib = (*LinearAxesNodeIt).GetAttribute(
"Axis");
272 if( !CurrAttrib.
Empty() )
273 Axis = CurrAttrib.
AsInt();
275 if( Axis < 0 || Axis > 2 )
278 CurrAttrib = (*LinearAxesNodeIt).GetAttribute(
"SpringStiffness");
279 if( !CurrAttrib.
Empty() )
282 CurrAttrib = (*LinearAxesNodeIt).GetAttribute(
"SpringDamping");
283 if( !CurrAttrib.
Empty() )
286 CurrAttrib = (*LinearAxesNodeIt).GetAttribute(
"SpringEnabled");
287 if( !CurrAttrib.
Empty() )
294 for(
XML::NodeIterator AngularAxesNodeIt = AngularAxesNode.
begin() ; AngularAxesNodeIt != AngularAxesNode.
end() ; ++AngularAxesNodeIt )
296 if( !(*AngularAxesNodeIt).Empty() ) {
297 if( (*AngularAxesNodeIt).GetAttribute(
"Version").AsInt() == 1 ) {
300 CurrAttrib = (*AngularAxesNodeIt).GetAttribute(
"Axis");
301 if( !CurrAttrib.
Empty() )
302 Axis = CurrAttrib.
AsInt();
304 if( Axis < 0 || Axis > 5 )
309 CurrAttrib = (*AngularAxesNodeIt).GetAttribute(
"SpringStiffness");
310 if( !CurrAttrib.
Empty() )
313 CurrAttrib = (*AngularAxesNodeIt).GetAttribute(
"SpringDamping");
314 if( !CurrAttrib.
Empty() )
317 CurrAttrib = (*AngularAxesNodeIt).GetAttribute(
"SpringEnabled");
318 if( !CurrAttrib.
Empty() )
335 {
return "Generic6DofSpringConstraint"; }
virtual void SetLinearSpringStiffnessOnAxis(const Real Stiffness, Whole TranslationAxis)
Sets the stiffness on a specific linear axis on this constraint.
Translation on the Z axis.
Attribute AppendAttribute(const Char8 *Name)
Creates an Attribute and puts it at the end of this Nodes attributes.
virtual void SetLinearSpringDampingOnAxis(const Real Damping, Whole TranslationAxis)
Sets the damping on a specific linear axis on this constraint.
virtual Boole GetLinearSpringEnabledOnAxis(Whole TranslationAxis) const
Get whether or not a spring is enabled on a specific linear axis on this constraint.
virtual Real GetSpringEquilibriumPoint(int Index) const
Gets the rest point of the spring on the specified axis.
virtual Vector3 GetLinearSpringEquilibriumPoints() const
Gets the rest point of the spring on each Linear axis.
A light-weight handle for manipulating attributes in DOM tree.
virtual void SetSpringDamping(int Index, Real Damping)
Set the spring Damping on a given axis.
bool Boole
Generally acts a single bit, true or false.
virtual void CalculateSpringEquilibriumPoints()
Autogenerates the equalibrium points on each axis of this constraint.
virtual Vector3 GetAngularSpringEnabled() const
Get the Enabled Status for all Angular Axis.
bool AsBool(bool def=false) const
Attempts to convert the value of the attribute to a float and returns the results.
Convenience type for loops.
Real X
Coordinate on the X vector.
virtual Real GetLinearSpringStiffnessOnAxis(Whole TranslationAxis) const
Gets the stiffness on a specific linear axis on this constraint.
virtual void SetAngularSpringEnabled(const Vector3 &Enableness)
Set the Stiffness of the springs on each Angular Axis.
Real Z
Coordinate on the Z vector.
Convenience type for loops.
virtual void SetAngularSpringDamping(const Vector3 &Damps)
Set the Damping of the springs on each Angular Axis.
virtual Vector3 GetLinearSpringDamping() const
Get the Damping for all Linear Axis.
virtual Boole GetAngularSpringEnabledOnAxis(Whole RotationAxis) const
Get whether or not a spring is enabled on a specific angular axis on this constraint.
virtual void SetAngularSpringEnabledOnAxis(const Boole Enabled, Whole RotationAxis)
Set whether or not a spring is enabled on a specific angular axis on this constraint.
Thrown when the requested identity could not be found.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
virtual void SetAngularSpringStiffness(const Vector3 &Stiffness)
Set the Stiffness of the springs on each Angular Axis.
int Integer
A datatype used to represent any integer close to.
virtual void SetLinearSpringDamping(const Vector3 &Damps)
Set the Damping of the springs on each Linear Axis.
Thrown when a version is accessed/parsed/required and it cannot work correctly or is missing...
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
virtual Real GetSpringDamping(int Index) const
Retrieve the Damping of the spring on the given axis.
virtual void CalculateSpringEquilibriumPoint(int Index)
Automatically assigns the rest point of the spring on the specified axis based on the current offset ...
Create simple but specific limits on any axis of movement or rotation.
virtual void SetAngularSpringStiffnessOnAxis(const Real Stiffness, Whole RotationAxis)
Sets the stiffness on a specific angular axis on this 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...
virtual void SetSpringEquilibriumPoint(int Index, const Real Point)
Sets the rest point of the spring on the specified axis.
bool Empty() const
Is this storing anything at all?
virtual void SetLinearSpringEnabled(const Vector3 &Enabled)
Set whether or not a spring is enabled on a specific linear axis on this constraint.
float Real
A Datatype used to represent a real floating point number.
The interface for serialization.
bool SetValue(const Char8 *rhs)
Set the value of this.
virtual Real GetSpringStiffness(int Index) const
Retrieve the Stiffness of the spring on the given axis.
virtual Real GetAngularSpringStiffnessOnAxis(Whole RotationAxis) const
Gets the stiffness on a specific angular axis on this constraint.
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
Child node iterator (a bidirectional iterator over a collection of Node)
virtual Vector3 GetAngularSpringDamping() const
Get the Damping for all Angular Axis.
virtual Vector3 GetAngularSpringStiffness() const
Get the Stiffness for all Angular Axis.
A light-weight handle for manipulating nodes in DOM tree.
iterator begin() const
Get a Child node iterator that references the first child Node.
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.
iterator end() const
Get a Child node iterator that references one past the last child Node.
bool Empty() const
Is this storing anything at all?
btGeneric6DofConstraint * Generic6dof
The internal constraint that this class encapsulates.
virtual btRigidBody * _GetPhysicsObject() const
Accessor for the internal rigid body physics proxy.
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 String GetDerivedSerializableName() const
Gets the most derived serializable name of this Constraint.
Real AsReal(Real def=0) const
Attempts to convert the value of the attribute to a Real and returns the results. ...
Real Y
Coordinate on the Y vector.
virtual void SetSpringStiffness(int Index, Real Stiffness)
Set the spring stiffness on a given axis.
virtual btGeneric6DofSpringConstraint * Generic6dofSpring() const
virtual void CreateConstraint(RigidProxy *RigidA, RigidProxy *RigidB, const Transform &TransA, const Transform &TransB)
Creates the internal constraint.
This is a proxy from which rigid body proxys are handled.
virtual void SetLinearSpringStiffness(const Vector3 &Stiffness)
Set the Stiffness of the springs on each Linear Axis.
This is simply a place for storing all the Physics Related functions.
virtual Vector3 GetAngularSpringEquilibriumPoints() const
Gets the rest point of the spring on each Angular axis.
virtual Vector3 GetLinearSpringEnabled() const
Get the Enabled Status for all Linear Axis.
static String GetSerializableName()
Get the name of the the XML tag the class will leave behind as its instances are serialized.
Translation on the X axis.
Convenience type for loops.
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.
virtual Whole ConvertAngularTo6Axis(const Whole Axis) const
Convert an angular Axis from a 3 digit range to a full 6 digit range.
The bulk of the engine components go in this namspace.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
virtual Real GetLinearSpringDampingOnAxis(Whole TranslationAxis) const
Gets the damping on a specific linear axis on this constraint.
virtual ~Generic6DofSpringConstraint()
Class destructor.
virtual Vector3 GetLinearSpringStiffness() const
Get the Stiffness for all Linear Axis.
virtual void SetSpringEnabled(int Index, Boole Enable)
Set the spring's enabled status on a given axis.
virtual Real GetAngularSpringDampingOnAxis(Whole RotationAxis) const
Gets the damping on a specific angular axis on this constraint.
virtual void SetLinearSpringEnabledOnAxis(const Boole Enabled, Whole TranslationAxis)
Set whether or not a spring is enabled on a specific linear axis on this constraint.
Translation on the Y axis.
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 Whole ConvertFrom6AxisTo3Axis(const Whole Axis) const
Convert an Axis from a full 6 digit range to a 3 digit range.
Attribute GetAttribute(const Char8 *Name) const
Attempt to get an Attribute on this Node with a given name.
Generic6DofSpringConstraint(const UInt32 ID, RigidProxy *Prox1, PhysicsManager *Creator)
Single body inheritance constructor.
virtual Boole GetSpringEnabled(int Index) const
Retrieve the EnabledStatus of the spring on the given axis.
virtual void SetAngularSpringDampingOnAxis(const Real Damping, Whole RotationAxis)
Sets the damping on a specific angular axis on this constraint.
Convenience type for loops.
Node GetChild(const Char8 *Name) const
Attempt to get a child Node with a given name.