Spinning Topp Logo BlackTopp Studios
inc
hingeconstraint.cpp
1 // © Copyright 2010 - 2016 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 #ifndef _physicshingeconstraint_cpp
41 #define _physicshingeconstraint_cpp
42 
43 #include "Physics/hingeconstraint.h"
44 #include "Physics/rigidproxy.h"
45 
46 #include "stringtool.h"
47 #include "serialization.h"
48 
49 #include <btBulletDynamicsCommon.h>
50 
51 namespace Mezzanine
52 {
53  namespace Physics
54  {
55  ////////////////////////////////////////////////////////////////////////////////
56  // Hinge Constraint Functions
57 
58  HingeConstraint::HingeConstraint(const UInt32 ID, RigidProxy* ProxyA, RigidProxy* ProxyB, const Vector3& PivotInA, const Vector3& PivotInB, const Vector3& AxisInA, const Vector3& AxisInB, PhysicsManager* Creator) :
59  DualTransformConstraint(ID,ProxyA,ProxyB,Creator),
60  Hinge(NULL)
61  { this->CreateConstraint(ProxyA,ProxyB,PivotInA,PivotInB,AxisInA,AxisInB); }
62 
63  HingeConstraint::HingeConstraint(const UInt32 ID, RigidProxy* ProxyA, RigidProxy* ProxyB, const Transform& TransA, const Transform& TransB, PhysicsManager* Creator) :
64  DualTransformConstraint(ID,ProxyA,ProxyB,Creator),
65  Hinge(NULL)
66  { this->CreateConstraint(ProxyA,ProxyB,TransA.GetBulletTransform(),TransB.GetBulletTransform()); }
67 
68  HingeConstraint::HingeConstraint(const UInt32 ID, RigidProxy* ProxyA, const Vector3& PivotInA, const Vector3& AxisInA, PhysicsManager* Creator) :
69  DualTransformConstraint(ID,ProxyA,Creator),
70  Hinge(NULL)
71  { this->CreateConstraint(ProxyA,NULL,PivotInA,Vector3(),AxisInA,Vector3()); }
72 
73  HingeConstraint::HingeConstraint(const UInt32 ID, RigidProxy* ProxyA, const Transform& TransA, PhysicsManager* Creator) :
74  DualTransformConstraint(ID,ProxyA,Creator),
75  Hinge(NULL)
76  { this->CreateConstraint(ProxyA,NULL,TransA.GetBulletTransform(),Transform()); }
77 
79  DualTransformConstraint(0,NULL,Creator),
80  Hinge(NULL)
81  { this->ProtoDeSerialize(SelfRoot); }
82 
84  { this->DestroyConstraint(); }
85 
86  void HingeConstraint::CreateConstraint(RigidProxy* RigidA, RigidProxy* RigidB, const Transform& TransA, const Transform& TransB)
87  {
88  if( this->Hinge == NULL ) {
89  if( RigidA && RigidB ) {
90  this->Hinge = new btHingeConstraint(*(RigidA->_GetPhysicsObject()),*(RigidB->_GetPhysicsObject()),TransA.GetBulletTransform(),TransB.GetBulletTransform(),false);
91  }else if( RigidA ) {
92  this->Hinge = new btHingeConstraint(*(RigidA->_GetPhysicsObject()),TransA.GetBulletTransform(),false);
93  }
94  }
95  }
96 
97  void HingeConstraint::CreateConstraint(RigidProxy* RigidA, RigidProxy* RigidB, const Vector3& PivotInA, const Vector3& PivotInB, const Vector3& AxisInA, const Vector3& AxisInB)
98  {
99  if( this->Hinge == NULL ) {
100  if( RigidA && RigidB ) {
101  this->Hinge = new btHingeConstraint(*(RigidA->_GetPhysicsObject()),*(RigidB->_GetPhysicsObject()),PivotInA.GetBulletVector3(),PivotInB.GetBulletVector3(),AxisInA.GetBulletVector3(),AxisInB.GetBulletVector3(),false);
102  }else if( RigidA ) {
103  this->Hinge = new btHingeConstraint(*(RigidA->_GetPhysicsObject()),PivotInA.GetBulletVector3(),AxisInA.GetBulletVector3(),false);
104  }
105  }
106  }
107 
109  {
110  this->EnableConstraint(false);
111  if( this->Hinge != NULL ) {
112  delete this->Hinge;
113  this->Hinge = NULL;
114  }
115  this->ProxA = NULL;
116  this->ProxB = NULL;
117  }
118 
119  ////////////////////////////////////////////////////////////////////////////////
120  // Position and Orientation
121 
122  void HingeConstraint::SetPivotTransforms(const Transform& TransA, const Transform& TransB)
123  { this->Hinge->setFrames(TransA.GetBulletTransform(),TransB.GetBulletTransform()); }
124 
126  { this->Hinge->setFrames(TransA.GetBulletTransform(),this->Hinge->getBFrame()); }
127 
129  { this->Hinge->setFrames(this->Hinge->getAFrame(),TransB.GetBulletTransform()); }
130 
132  { return Transform(this->Hinge->getAFrame()); }
133 
135  { return Transform(this->Hinge->getBFrame()); }
136 
138  { this->Hinge->getAFrame().setOrigin(Location.GetBulletVector3()); }
139 
141  { this->Hinge->getBFrame().setOrigin(Location.GetBulletVector3()); }
142 
144  { return Vector3(this->Hinge->getAFrame().getOrigin()); }
145 
147  { return Vector3(this->Hinge->getBFrame().getOrigin()); }
148 
150  { this->Hinge->getBFrame().setRotation(Rotation.GetBulletQuaternion()); }
151 
153  { this->Hinge->getBFrame().setRotation(Rotation.GetBulletQuaternion()); }
154 
156  { return Quaternion(this->Hinge->getAFrame().getRotation()); }
157 
159  { return Quaternion(this->Hinge->getBFrame().getRotation()); }
160 
161  ////////////////////////////////////////////////////////////////////////////////
162  // Utility
163 
164  void HingeConstraint::SetAxis(const Vector3& AxisInA)
165  { btVector3 Temp = AxisInA.GetBulletVector3(); this->Hinge->setAxis(Temp); }
166 
168  { return this->Hinge->getHingeAngle(); }
169 
171  { this->Hinge->setUseFrameOffset(FrameOffset); }
172 
174  { return this->Hinge->getUseFrameOffset(); }
175 
176  void HingeConstraint::SetUseReferenceFrameA(const Boole UseReferenceFrameA)
177  { this->Hinge->setUseReferenceFrameA(UseReferenceFrameA); }
178 
180  { return this->Hinge->getUseReferenceFrameA(); }
181 
182  ////////////////////////////////////////////////////////////////////////////////
183  // Limits
184 
185  void HingeConstraint::SetLimits(Real Low, Real High, Real Softness, Real BiasFactor, Real RelaxationFactor)
186  { this->Hinge->setLimit(Low, High, Softness, BiasFactor, RelaxationFactor); }
187 
189  { return this->Hinge->getLowerLimit(); }
190 
192  { return this->Hinge->getUpperLimit(); }
193 
195  { return this->Hinge->getLimitSoftness(); }
196 
198  { return this->Hinge->getLimitBiasFactor(); }
199 
201  { return this->Hinge->getLimitRelaxationFactor(); }
202 
203  ////////////////////////////////////////////////////////////////////////////////
204  // Angular Motor
205 
206  void HingeConstraint::EnableMotor(const Boole EnableMotor, const Real TargetVelocity, const Real MaxMotorImpulse)
207  { this->Hinge->enableAngularMotor(EnableMotor, TargetVelocity, MaxMotorImpulse); }
208 
209  void HingeConstraint::SetMotorEnabled(const Boole EnableMotor)
210  { this->Hinge->enableMotor(EnableMotor); }
211 
213  { return this->Hinge->getEnableAngularMotor(); }
214 
215  void HingeConstraint::SetMaxMotorImpulse(const Real MaxMotorImpulse)
216  { this->Hinge->setMaxMotorImpulse(MaxMotorImpulse); }
217 
219  { return this->Hinge->getMaxMotorImpulse(); }
220 
222  { this->Hinge->setMotorTargetVelocity(TargetVelocity); }
223 
225  { return this->Hinge->getMotorTargetVelosity(); }
226 
227  void HingeConstraint::SetMotorTarget(const Quaternion& QuatAInB, const Real Delta)
228  { this->Hinge->setMotorTarget(QuatAInB.GetBulletQuaternion(),Delta); }
229 
230  void HingeConstraint::SetMotorTarget(const Real TargetAngle, const Real Delta)
231  { this->Hinge->setMotorTarget(TargetAngle,Delta); }
232 
233  ////////////////////////////////////////////////////////////////////////////////
234  // Parameter Configuration
235 
237  {
238  Constraint::ParamList Results;
239  if( -1 == Axis || 5 == Axis ) {
240  Results.push_back(Con_Stop_ERP);
241  Results.push_back(Con_CFM);
242  Results.push_back(Con_Stop_CFM);
243  }
244  return Results;
245  }
246 
248  {
249  Constraint::AxisList Results;
250  Results.push_back(-1);
251  return Results;
252  }
253 
255  {
256  Constraint::AxisList Results;
257  Results.push_back(5);
258  return Results;
259  }
260 
262  {
263  // the logic here should match the logic in the source at http://bulletphysics.com/Bullet/BulletFull/btHingeConstraint_8cpp_source.html#l00962
264  if ( -1!=Axis && 5!=Axis )
265  { return false; }
266  return ( Con_Stop_ERP==Param && this->Hinge->getFlags() & BT_HINGE_FLAGS_ERP_STOP ) || //if we are checking the stop_erp AND the stop_erp bit is set
267  ( Con_Stop_CFM==Param && this->Hinge->getFlags() & BT_HINGE_FLAGS_CFM_STOP ) || //if we are checking the stop_cfm AND the stop_cfm bit is set
268  ( Con_CFM==Param && this->Hinge->getFlags() & BT_HINGE_FLAGS_CFM_NORM ) ; //if we are checking the cfm AND the cfm bit is set
269  }
270 
271  ////////////////////////////////////////////////////////////////////////////////
272  // Serialization
273 
275  {
276  this->Constraint::ProtoSerializeProperties(SelfRoot);
277 
278  XML::Node PropertiesNode = SelfRoot.AppendChild( HingeConstraint::GetSerializableName() + "Properties" );
279 
280  if( PropertiesNode.AppendAttribute("Version").SetValue("1") &&
281  PropertiesNode.AppendAttribute("UseFrameOffset").SetValue( this->GetUseFrameOffset() ) &&
282  PropertiesNode.AppendAttribute("UseReferenceFrameA").SetValue( this->GetUseReferenceFrameA() ) &&
283  PropertiesNode.AppendAttribute("LimitLow").SetValue( this->GetLimitLow() ) &&
284  PropertiesNode.AppendAttribute("LimitHigh").SetValue( this->GetLimitHigh() ) &&
285  PropertiesNode.AppendAttribute("LimitSoftness").SetValue( this->GetLimitSoftness() ) &&
286  PropertiesNode.AppendAttribute("LimitBiasFactor").SetValue( this->GetLimitBiasFactor() ) &&
287  PropertiesNode.AppendAttribute("LimitRelaxationFactor").SetValue( this->GetLimitRelaxationFactor() ) &&
288  PropertiesNode.AppendAttribute("MotorEnabled").SetValue( this->GetMotorEnabled() ) &&
289  PropertiesNode.AppendAttribute("MaxMotorImpulse").SetValue( this->GetMaxMotorImpulse() ) &&
290  PropertiesNode.AppendAttribute("MotorTargetVelocity").SetValue( this->GetMotorTargetVelocity() ) )
291  {
292  return;
293  }else{
294  SerializeError("Create XML Attribute Values",HingeConstraint::GetSerializableName() + "Properties",true);
295  }
296  }
297 
299  {
301 
302  XML::Attribute CurrAttrib;
303  XML::Node PropertiesNode = SelfRoot.GetChild( HingeConstraint::GetSerializableName() + "Properties" );
304 
305  if( !PropertiesNode.Empty() ) {
306  if( PropertiesNode.GetAttribute("Version").AsInt() == 1 ) {
307  Real LimitLow = 0.0;
308  Real LimitHigh = 0.0;
309  Real LimitSoftness = 0.9;
310  Real LimitBiasFactor = 0.3;
311  Real LimitRelaxationFactor = 1.0;
312 
313  CurrAttrib = PropertiesNode.GetAttribute("UseFrameOffset");
314  if( !CurrAttrib.Empty() )
315  this->SetUseFrameOffset( CurrAttrib.AsBool() );
316 
317  CurrAttrib = PropertiesNode.GetAttribute("UseReferenceFrameA");
318  if( !CurrAttrib.Empty() )
319  this->SetUseReferenceFrameA( CurrAttrib.AsBool() );
320 
321  CurrAttrib = PropertiesNode.GetAttribute("LimitLow");
322  if( !CurrAttrib.Empty() )
323  LimitLow = CurrAttrib.AsReal();
324 
325  CurrAttrib = PropertiesNode.GetAttribute("LimitHigh");
326  if( !CurrAttrib.Empty() )
327  LimitHigh = CurrAttrib.AsReal();
328 
329  CurrAttrib = PropertiesNode.GetAttribute("LimitSoftness");
330  if( !CurrAttrib.Empty() )
331  LimitSoftness = CurrAttrib.AsReal();
332 
333  CurrAttrib = PropertiesNode.GetAttribute("LimitBiasFactor");
334  if( !CurrAttrib.Empty() )
335  LimitBiasFactor = CurrAttrib.AsReal();
336 
337  CurrAttrib = PropertiesNode.GetAttribute("LimitRelaxationFactor");
338  if( !CurrAttrib.Empty() )
339  LimitRelaxationFactor = CurrAttrib.AsReal();
340 
341  this->SetLimits(LimitLow,LimitHigh,LimitSoftness,LimitBiasFactor,LimitRelaxationFactor);
342 
343  CurrAttrib = PropertiesNode.GetAttribute("MotorEnabled");
344  if( !CurrAttrib.Empty() )
345  this->SetMotorEnabled( CurrAttrib.AsBool() );
346 
347  CurrAttrib = PropertiesNode.GetAttribute("MaxMotorImpulse");
348  if( !CurrAttrib.Empty() )
349  this->SetMaxMotorImpulse( CurrAttrib.AsReal() );
350 
351  CurrAttrib = PropertiesNode.GetAttribute("MotorTargetVelocity");
352  if( !CurrAttrib.Empty() )
353  this->SetMotorTargetVelocity( CurrAttrib.AsReal() );
354  }else{
355  MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + ( HingeConstraint::GetSerializableName() + "Properties" ) + ": Not Version 1.");
356  }
357  }else{
358  MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_NOT_FOUND_EXCEPTION,HingeConstraint::GetSerializableName() + "Properties" + " was not found in the provided XML node, which was expected.");
359  }
360  }
361 
364 
366  { return "HingeConstraint"; }
367 
368  ////////////////////////////////////////////////////////////////////////////////
369  // Internal
370 
371  btTypedConstraint* HingeConstraint::_GetConstraintBase() const
372  { return this->Hinge; }
373  }//Physics
374 }//Mezzanine
375 
376 ///////////////////////////////////////////////////////////////////////////////
377 // Class External << Operators for streaming or assignment
378 
379 std::ostream& operator << (std::ostream& stream, const Mezzanine::Physics::HingeConstraint& x)
380 {
381  Mezzanine::Serialize(stream,x);
382  return stream;
383 }
384 
385 std::istream& operator >> (std::istream& stream, Mezzanine::Physics::HingeConstraint& x)
386  { return Mezzanine::DeSerialize(stream, x); }
387 
389  { x.ProtoDeSerialize(OneNode); }
390 
391 #endif
virtual Constraint::AxisList GetValidAngularAxes() const
Get A list sorted (low to high) of all axis that operate Angularly (that lock sliding/translation) ...
std::ostream & operator<<(std::ostream &stream, const Mezzanine::LinearInterpolator< T > &Lint)
Used to Serialize an Mezzanine::LinearInterpolator to a human readable stream.
Definition: interpolator.h:433
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
std::vector< int > AxisList
Used to Store lists of Int Axis for return types.
Definition: constraint.h:124
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 ...
Definition: constraint.h:65
virtual void SetAPivotRotation(const Quaternion &Rotation)
A light-weight handle for manipulating attributes in DOM tree.
Definition: attribute.h:74
virtual Real GetLimitLow() const
Return the Lower Limit of the hinge.
All constraints that track rotation and location of the Pivot relative to each Actor inherit from thi...
bool Boole
Generally acts a single bit, true or false.
Definition: datatypes.h:173
virtual Vector3 GetPivotBLocation() const
Gets the location of the pivot relative to ProxB's Center of gravity.
bool AsBool(bool def=false) const
Attempts to convert the value of the attribute to a float and returns the results.
virtual Real GetLimitRelaxationFactor() const
Return the Relaxation Factor of the hinge.
virtual Real GetLimitHigh() const
Return the Upper Limit of the hinge.
virtual Boole GetUseFrameOffset() const
Gets whether or not an offset of the constraint frame should be used to calculate internal data...
virtual void SetMaxMotorImpulse(const Real MaxMotorImpulse)
Sets the maximum amount of force the motor is to apply.
virtual Real GetLimitSoftness() const
Return the Softness of the hinge.
Thrown when the requested identity could not be found.
Definition: exception.h:94
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
Definition: exception.h:3048
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 SetPivotBTransform(const Transform &TransB)
Thrown when a version is accessed/parsed/required and it cannot work correctly or is missing...
Definition: exception.h:112
virtual btTypedConstraint * _GetConstraintBase() const
Get the Bullet constraint that this class encapsulates.
virtual Boole GetUseReferenceFrameA() const
Gets whether or not to perform linear math from ProxyA's perspective.
virtual Constraint::AxisList GetValidLinearAxes() const
Get a sorted (low to high) list of all axis that operate linearly (that lock sliding/translation) ...
virtual void EnableConstraint(const Boole Enable)
Enables or disables this constraint.
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 SetUseFrameOffset(const Boole FrameOffset)
Sets whether or not an offset of the constraint frame should be used to calculate internal data...
btQuaternion GetBulletQuaternion(Boole normalize=false) const
Gets a Bullet quaternion.
Definition: quaternion.cpp:243
virtual Real GetMotorTargetVelocity() const
Get the Target Velocity.
virtual Boole GetMotorEnabled() const
Is this motor on this hinge enabled?
float Real
A Datatype used to represent a real floating point number.
Definition: datatypes.h:141
The interface for serialization.
virtual void SetUseReferenceFrameA(const Boole UseRefFrameA)
Sets whether or not to perform linear math from ProxyA's perspective.
bool SetValue(const Char8 *rhs)
Set the value of this.
btTransform GetBulletTransform() const
Gets a Bullet Transform.
Definition: transform.cpp:71
HingeConstraint(const UInt32 ID, RigidProxy *ProxyA, RigidProxy *ProxyB, const Vector3 &PivotInA, const Vector3 &PivotInB, const Vector3 &AxisInA, const Vector3 &AxisInB, PhysicsManager *Creator)
Convenience axis constructor.
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.
Definition: vector3.cpp:555
A light-weight handle for manipulating nodes in DOM tree.
Definition: node.h:89
virtual void SetPivotATransform(const Transform &TransA)
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.
Definition: datatypes.h:126
bool Empty() const
Is this storing anything at all?
virtual String GetDerivedSerializableName() const
Gets the most derived serializable name of this Constraint.
virtual btRigidBody * _GetPhysicsObject() const
Accessor for the internal rigid body physics proxy.
Definition: rigidproxy.cpp:406
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.
Definition: constraint.h:61
virtual Transform GetPivotBTransform() const
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 SetMotorTargetVelocity(const Real TargetVelocity)
Desired angular velocity of the motor.
virtual Boole HasParamBeenSet(ConstraintParam Param, int Axis) const
virtual void SetMotorTarget(const Quaternion &QuatAInB, const Real Delta)
Sets a Target Velocity, indirectly using the angle stored in a quaternion.
std::istream & DeSerialize(std::istream &Stream, T &Converted)
Deserialize the next xml tag in the stream into a specific in memory class instance.
virtual void EnableMotor(const Boole EnableMotor, const Real TargetVelocity, const Real MaxMotorImpulse)
Enables(or Disables) the motor on the hinge and sets it's parameters.
virtual Vector3 GetPivotALocation() const
Gets the location of the pivot relative to ProxA's Center of gravity.
This is a proxy from which rigid body proxys are handled.
Definition: rigidproxy.h:102
virtual void SetPivotALocation(const Vector3 &Location)
Sets The relative location of the pivot from ProxA's Center of gravity.
Stores information about relative location and rotation in 3d space.
Definition: transform.h:62
std::vector< ConstraintParam > ParamList
Used to Store lists of param for return types.
Definition: constraint.h:120
This is simply a place for storing all the Physics Related functions.
RigidProxy * ProxA
The first Collidable this constraint applies to.
Definition: constraint.h:130
virtual void SetPivotBLocation(const Vector3 &Location)
Sets The relative location of the pivot from ProxB's Center of gravity.
This is a constraint to be used to restrict the movement between two objects to angular rotation on a...
static String GetSerializableName()
Get the name of the the XML tag the class will leave behind as its instances are serialized.
virtual void CreateConstraint(RigidProxy *RigidA, RigidProxy *RigidB, const Transform &TransA, const Transform &TransB)
Creates the internal constraint.
This is used to represent a point in space, or a vector through space.
Definition: vector3.h:77
virtual void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
virtual void DestroyConstraint()
Destroys the internal constraint.
RigidProxy * ProxB
The second Collidable this constraint applies to.
Definition: constraint.h:133
virtual Constraint::ParamList GetValidParamsOnAxis(int Axis) const
Get a sorted (low to high) list of Parameters that are valid on this Axis.
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
std::istream & operator>>(std::istream &stream, Mezzanine::LinearInterpolator< T > &Lint)
Used to de-serialize an Mezzanine::LinearInterpolator from a stream.
Definition: interpolator.h:448
virtual void SetMotorEnabled(const Boole EnableMotor)
Enables(or Disables) the motor on the hinge.
virtual Real GetHingeAngle()
Gets the current angle of the hinge.
virtual Real GetMaxMotorImpulse() const
Retrieve the maximimum value that the acceleration of the motor can be increased. ...
virtual void SetAxis(const Vector3 &AxisInA)
Sets the axis on which this constraint acts.
virtual Quaternion GetBPivotRotation() const
virtual Transform GetPivotATransform() const
This is used to store information about rotation in 3d space.
Definition: quaternion.h:68
virtual Real GetLimitBiasFactor() const
Return the bias factor of the hinge (Not entirely certain hat this on is)
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.
Definition: datatypes.h:159
virtual void SetLimits(const Real Low, const Real High, const Real Softness=0.9, const Real BiasFactor=0.3, const Real RelaxationFactor=1.0)
Sets the angle limits of the constraint in radians.
Attribute GetAttribute(const Char8 *Name) const
Attempt to get an Attribute on this Node with a given name.
virtual void SetPivotTransforms(const Transform &TransA, const Transform &TransB)
Sets the Position and Rotation for the first and second body using a Transform.
virtual ~HingeConstraint()
Class destructor.
btHingeConstraint * Hinge
Bullet constraint that this class encapsulates.
Node GetChild(const Char8 *Name) const
Attempt to get a child Node with a given name.
virtual Quaternion GetAPivotRotation() const
virtual void SetBPivotRotation(const Quaternion &Rotation)