Spinning Topp Logo BlackTopp Studios
inc
sliderconstraint.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 _physicssliderconstraint_cpp
41 #define _physicssliderconstraint_cpp
42 
43 #include "Physics/sliderconstraint.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  // Slider Constraint Functions
57 
58  SliderConstraint::SliderConstraint(const UInt32 ID, RigidProxy* ProxyA, RigidProxy* ProxyB, const Transform& TransA, const Transform& TransB, PhysicsManager* Creator) :
59  DualTransformConstraint(ID,ProxyA,ProxyB,Creator),
60  Slider(NULL)
61  { this->CreateConstraint(ProxyA,ProxyB,TransA,TransB); }
62 
63  SliderConstraint::SliderConstraint(const UInt32 ID, RigidProxy* ProxyA, const Transform& TransA, PhysicsManager* Creator) :
64  DualTransformConstraint(ID,ProxyA,Creator),
65  Slider(NULL)
66  { this->CreateConstraint(ProxyA,NULL,TransA,Transform()); }
67 
69  DualTransformConstraint(0,NULL,Creator),
70  Slider(NULL)
71  { this->ProtoDeSerialize(SelfRoot); }
72 
74  { this->DestroyConstraint(); }
75 
76  void SliderConstraint::CreateConstraint(RigidProxy* RigidA, RigidProxy* RigidB, const Transform& TransA, const Transform& TransB)
77  {
78  if( this->Slider == NULL ) {
79  if( RigidA && RigidB ) {
80  this->Slider = new btSliderConstraint(*(RigidA->_GetPhysicsObject()),*(RigidB->_GetPhysicsObject()),TransA.GetBulletTransform(),TransB.GetBulletTransform(),false);
81  }else if( RigidA ) {
82  this->Slider = new btSliderConstraint(*(RigidA->_GetPhysicsObject()),TransA.GetBulletTransform(),false);
83  }
84  }
85  }
86 
88  {
89  this->EnableConstraint(false);
90  if( this->Slider != NULL ) {
91  delete this->Slider;
92  this->Slider = NULL;
93  }
94  this->ProxA = NULL;
95  this->ProxB = NULL;
96  }
97 
98  ////////////////////////////////////////////////////////////////////////////////
99  // Location and Rotation
100 
101  void SliderConstraint::SetPivotTransforms(const Transform& TransA, const Transform& TransB)
102  { this->Slider->setFrames(TransA.GetBulletTransform(),TransB.GetBulletTransform()); }
103 
105  { this->Slider->getFrameOffsetA() = TranA.GetBulletTransform(); }
106 
108  { this->Slider->getFrameOffsetB() = TranB.GetBulletTransform(); }
109 
111  { return this->Slider->getFrameOffsetA(); }
112 
114  { return this->Slider->getFrameOffsetB(); }
115 
117  { this->Slider->getFrameOffsetA().setOrigin(Location.GetBulletVector3()); }
118 
120  { this->Slider->getFrameOffsetB().setOrigin(Location.GetBulletVector3()); }
121 
123  { return Vector3(this->Slider->getFrameOffsetA().getOrigin()); }
124 
126  { return Vector3(this->Slider->getFrameOffsetB().getOrigin()); }
127 
129  { this->Slider->getFrameOffsetA().setRotation(Rotation.GetBulletQuaternion()); }
130 
132  { this->Slider->getFrameOffsetA().setRotation(Rotation.GetBulletQuaternion()); }
133 
135  { return Quaternion(this->Slider->getFrameOffsetA().getRotation()); }
136 
138  { return Quaternion(this->Slider->getFrameOffsetB().getRotation()); }
139 
140  ////////////////////////////////////////////////////////////////////////////////
141  // Utility
142 
144  { this->Slider->setUseFrameOffset(FrameOffset); }
145 
147  { return this->Slider->getUseFrameOffset(); }
148 
150  { this->Slider->setUpperLinLimit(UpperLimit); }
151 
153  { return this->Slider->getUpperLinLimit(); }
154 
156  { this->Slider->setUpperAngLimit(UpperLimit); }
157 
159  { return this->Slider->getUpperAngLimit(); }
160 
162  { this->Slider->setLowerLinLimit(LowerLimit); }
163 
165  { return this->Slider->getLowerLinLimit(); }
166 
168  { this->Slider->setLowerAngLimit(LowerLimit); }
169 
171  { return this->Slider->getLowerAngLimit(); }
172 
174  { this->Slider->setPoweredLinMotor(OnOff); }
175 
177  { return this->Slider->getPoweredLinMotor(); }
178 
180  { this->Slider->setPoweredAngMotor(OnOff); }
181 
183  { return this->Slider->getPoweredAngMotor(); }
184 
185  void SliderConstraint::SetTargetLinMotorVelocity(const Real TargetLinMotorVelocity)
186  { this->Slider->setTargetLinMotorVelocity(TargetLinMotorVelocity); }
187 
189  { return this->Slider->getTargetLinMotorVelocity(); }
190 
191  void SliderConstraint::SetTargetAngMotorVelocity(const Real TargetAngMotorVelocity)
192  { this->Slider->setTargetAngMotorVelocity(TargetAngMotorVelocity); }
193 
195  { return this->Slider->getTargetAngMotorVelocity(); }
196 
197  void SliderConstraint::SetMaxLinMotorForce(const Real MaxLinMotorForce)
198  { this->Slider->setMaxLinMotorForce(MaxLinMotorForce); }
199 
201  { return this->Slider->getMaxLinMotorForce(); }
202 
203  void SliderConstraint::SetMaxAngMotorForce(const Real MaxAngMotorForce)
204  { this->Slider->setMaxAngMotorForce(MaxAngMotorForce); }
205 
207  { return this->Slider->getMaxAngMotorForce(); }
208 
209  void SliderConstraint::SetSoftnessLimLin(const Real SoftnessLimLin)
210  { this->Slider->setSoftnessLimLin(SoftnessLimLin); }
211 
213  { return this->Slider->getSoftnessLimLin(); }
214 
215  void SliderConstraint::SetSoftnessLimAng(const Real SoftnessLimAng)
216  { this->Slider->setSoftnessLimAng(SoftnessLimAng); }
217 
219  { return this->Slider->getSoftnessLimAng(); }
220 
221  void SliderConstraint::SetSoftnessOrthoLin(const Real SoftnessOrthoLin)
222  { this->Slider->setSoftnessOrthoLin(SoftnessOrthoLin); }
223 
225  { return this->Slider->getSoftnessOrthoLin(); }
226 
227  void SliderConstraint::SetSoftnessOrthoAng(const Real SoftnessOrthoAng)
228  { this->Slider->setSoftnessOrthoAng(SoftnessOrthoAng); }
229 
231  { return this->Slider->getSoftnessOrthoAng(); }
232 
233  ///////////////////////////////////////////////////////////////////////////////
234  // Obsolete Methods - All methods listed in this subsection appears to alter deprecated/unused data
235 
236  void SliderConstraint::SetSoftnessDirLin(const Real SoftnessDirLin)
237  { this->Slider->setSoftnessDirLin(SoftnessDirLin); }
238 
240  { return this->Slider->getSoftnessDirLin(); }
241 
242  void SliderConstraint::SetSoftnessDirAng(const Real SoftnessDirAng)
243  { this->Slider->setSoftnessDirAng(SoftnessDirAng); }
244 
246  { return this->Slider->getSoftnessDirAng(); }
247 
248  void SliderConstraint::SetDampingDirLin(const Real DampingDirLin)
249  { this->Slider->setDampingDirLin(DampingDirLin); }
250 
252  { return this->Slider->getDampingDirLin(); }
253 
254  void SliderConstraint::SetDampingDirAng(const Real DampingDirAng)
255  { this->Slider->setDampingDirAng(DampingDirAng); }
256 
258  { return this->Slider->getDampingDirAng(); }
259 
260  void SliderConstraint::SetDampingLimLin(const Real DampingLimLin)
261  { this->Slider->setDampingLimLin(DampingLimLin); }
262 
264  { return this->Slider->getDampingLimLin(); }
265 
266  void SliderConstraint::SetDampingLimAng(const Real DampingLimAng)
267  { this->Slider->setDampingLimAng(DampingLimAng); }
268 
270  { return this->Slider->getDampingLimAng(); }
271 
272  void SliderConstraint::SetDampingOrthoLin(const Real DampingOrthoLin)
273  { this->Slider->setDampingOrthoLin(DampingOrthoLin); }
274 
276  { return this->Slider->getDampingOrthoLin(); }
277 
278  void SliderConstraint::SetDampingOrthoAng(const Real DampingOrthoAng)
279  { this->Slider->setDampingOrthoAng(DampingOrthoAng); }
280 
282  { return this->Slider->getDampingOrthoAng(); }
283 
284  void SliderConstraint::SetRestitutionDirLin(const Real RestitutionDirLin)
285  { this->Slider->setRestitutionDirLin(RestitutionDirLin); }
286 
288  { return this->Slider->getRestitutionDirLin(); }
289 
290  void SliderConstraint::SetRestitutionDirAng(const Real RestitutionDirAng)
291  { this->Slider->setRestitutionDirAng(RestitutionDirAng); }
292 
294  { return this->Slider->getRestitutionDirAng(); }
295 
296  void SliderConstraint::SetRestitutionLimLin(const Real RestitutionLimLin)
297  { this->Slider->setRestitutionLimLin(RestitutionLimLin); }
298 
300  { return this->Slider->getRestitutionLimLin(); }
301 
302  void SliderConstraint::SetRestitutionLimAng(const Real RestitutionLimAng)
303  { this->Slider->setRestitutionLimAng(RestitutionLimAng); }
304 
306  { return this->Slider->getRestitutionLimAng(); }
307 
308  void SliderConstraint::SetRestitutionOrthoLin(const Real RestitutionOrthoLin)
309  { this->Slider->setRestitutionOrthoLin(RestitutionOrthoLin); }
310 
312  { return this->Slider->getRestitutionOrthoLin(); }
313 
314  void SliderConstraint::SetRestitutionOrthoAng(const Real RestitutionOrthoAng)
315  { this->Slider->setRestitutionOrthoAng(RestitutionOrthoAng); }
316 
318  { return this->Slider->getRestitutionOrthoAng(); }
319 
320  ///////////////////////////////////////////////////////////////////////////////
321  // Parameter Configuration
322 
324  {
325  Constraint::ParamList Results;
326  if( 0 <= Axis && 5 >= Axis ) {
327  Results.push_back(Con_Stop_ERP);
328  Results.push_back(Con_CFM);
329  Results.push_back(Con_Stop_CFM);
330  }
331  return Results;
332  }
333 
335  {
336  Constraint::AxisList Results;
337  Results.push_back(0);
338  Results.push_back(1);
339  Results.push_back(2);
340  return Results;
341  }
342 
344  {
345  Constraint::AxisList Results;
346  Results.push_back(3);
347  Results.push_back(4);
348  Results.push_back(5);
349  return Results;
350  }
351 
353  {
354  // the logic here should match the logic in the source at http://bulletphysics.com/Bullet/BulletFull/btGeneric6DofConstraint_8cpp_source.html#l00964
355  if(0>Axis || 5<Axis)
356  { return false; }
357 
358  if( Con_Stop_ERP == Param )
359  {
360  if( this->Slider->getFlags() & BT_SLIDER_FLAGS_ERP_LIMLIN ) return true;
361  if( this->Slider->getFlags() & BT_SLIDER_FLAGS_ERP_ORTLIN ) return true;
362  if( this->Slider->getFlags() & BT_SLIDER_FLAGS_ERP_LIMANG ) return true;
363  if( this->Slider->getFlags() & BT_SLIDER_FLAGS_ERP_ORTANG ) return true;
364  }
365  else if( Con_Stop_CFM == Param )
366  {
367  if( this->Slider->getFlags() & BT_SLIDER_FLAGS_CFM_DIRLIN ) return true;
368  if( this->Slider->getFlags() & BT_SLIDER_FLAGS_CFM_DIRANG ) return true;
369  }
370  else if( Con_CFM == Param )
371  {
372  if( this->Slider->getFlags() & BT_SLIDER_FLAGS_CFM_LIMLIN ) return true;
373  if( this->Slider->getFlags() & BT_SLIDER_FLAGS_CFM_ORTLIN ) return true;
374  if( this->Slider->getFlags() & BT_SLIDER_FLAGS_CFM_LIMANG ) return true;
375  if( this->Slider->getFlags() & BT_SLIDER_FLAGS_CFM_ORTANG ) return true;
376  }
377  return false;
378  }
379 
380  ///////////////////////////////////////////////////////////////////////////////
381  // Serialization
382 
384  {
385  this->Constraint::ProtoSerializeProperties(SelfRoot);
386 
387  XML::Node PropertiesNode = SelfRoot.AppendChild( SliderConstraint::GetSerializableName() + "Properties" );
388 
389  if( PropertiesNode.AppendAttribute("Version").SetValue("1") &&
390  PropertiesNode.AppendAttribute("UseFrameOffset").SetValue( this->GetUseFrameOffset() ) &&
391  PropertiesNode.AppendAttribute("UpperLinLimit").SetValue( this->GetUpperLinLimit() ) &&
392  PropertiesNode.AppendAttribute("UpperAngLimit").SetValue( this->GetUpperAngLimit() ) &&
393  PropertiesNode.AppendAttribute("LowerLinLimit").SetValue( this->GetLowerLinLimit() ) &&
394  PropertiesNode.AppendAttribute("LowerAngLimit").SetValue( this->GetLowerAngLimit() ) &&
395  PropertiesNode.AppendAttribute("PoweredLinMotor").SetValue( this->GetPoweredLinMotor() ) &&
396  PropertiesNode.AppendAttribute("PoweredAngMotor").SetValue( this->GetPoweredAngMotor() ) &&
397  PropertiesNode.AppendAttribute("TargetLinMotorVelocity").SetValue( this->GetTargetLinMotorVelocity() ) &&
398  PropertiesNode.AppendAttribute("TargetAngMotorVelocity").SetValue( this->GetTargetAngMotorVelocity() ) &&
399  PropertiesNode.AppendAttribute("MaxLinMotorForce").SetValue( this->GetMaxLinMotorForce() ) &&
400  PropertiesNode.AppendAttribute("MaxAngMotorForce").SetValue( this->GetMaxAngMotorForce() ) &&
401  PropertiesNode.AppendAttribute("SoftnessLimLin").SetValue( this->GetSoftnessLimLin() ) &&
402  PropertiesNode.AppendAttribute("SoftnessLimAng").SetValue( this->GetSoftnessLimAng() ) &&
403  PropertiesNode.AppendAttribute("SoftnessOrthoLin").SetValue( this->GetSoftnessOrthoLin() ) &&
404  PropertiesNode.AppendAttribute("SoftnessOrthoAng").SetValue( this->GetSoftnessOrthoAng() ) )
405  {
406  return;
407  }else{
408  SerializeError("Create XML Attribute Values",SliderConstraint::GetSerializableName() + "Properties",true);
409  }
410  }
411 
413  {
415 
416  XML::Attribute CurrAttrib;
417  XML::Node PropertiesNode = SelfRoot.GetChild( SliderConstraint::GetSerializableName() + "Properties" );
418 
419  if( !PropertiesNode.Empty() ) {
420  if( PropertiesNode.GetAttribute("Version").AsInt() == 1 ) {
421  CurrAttrib = PropertiesNode.GetAttribute("UseFrameOffset");
422  if( !CurrAttrib.Empty() )
423  this->SetUseFrameOffset( CurrAttrib.AsBool() );
424 
425  CurrAttrib = PropertiesNode.GetAttribute("UpperLinLimit");
426  if( !CurrAttrib.Empty() )
427  this->SetUpperLinLimit( CurrAttrib.AsReal() );
428 
429  CurrAttrib = PropertiesNode.GetAttribute("UpperAngLimit");
430  if( !CurrAttrib.Empty() )
431  this->SetUpperAngLimit( CurrAttrib.AsReal() );
432 
433  CurrAttrib = PropertiesNode.GetAttribute("LowerLinLimit");
434  if( !CurrAttrib.Empty() )
435  this->SetLowerLinLimit( CurrAttrib.AsReal() );
436 
437  CurrAttrib = PropertiesNode.GetAttribute("LowerAngLimit");
438  if( !CurrAttrib.Empty() )
439  this->SetLowerAngLimit( CurrAttrib.AsReal() );
440 
441  CurrAttrib = PropertiesNode.GetAttribute("PoweredLinMotor");
442  if( !CurrAttrib.Empty() )
443  this->SetPoweredLinMotor( CurrAttrib.AsBool() );
444 
445  CurrAttrib = PropertiesNode.GetAttribute("PoweredAngMotor");
446  if( !CurrAttrib.Empty() )
447  this->SetPoweredAngMotor( CurrAttrib.AsBool() );
448 
449  CurrAttrib = PropertiesNode.GetAttribute("TargetLinMotorVelocity");
450  if( !CurrAttrib.Empty() )
451  this->SetTargetLinMotorVelocity( CurrAttrib.AsReal() );
452 
453  CurrAttrib = PropertiesNode.GetAttribute("TargetAngMotorVelocity");
454  if( !CurrAttrib.Empty() )
455  this->SetTargetAngMotorVelocity( CurrAttrib.AsReal() );
456 
457  CurrAttrib = PropertiesNode.GetAttribute("MaxLinMotorForce");
458  if( !CurrAttrib.Empty() )
459  this->SetMaxLinMotorForce( CurrAttrib.AsReal() );
460 
461  CurrAttrib = PropertiesNode.GetAttribute("MaxAngMotorForce");
462  if( !CurrAttrib.Empty() )
463  this->SetMaxAngMotorForce( CurrAttrib.AsReal() );
464 
465  CurrAttrib = PropertiesNode.GetAttribute("SoftnessLimLin");
466  if( !CurrAttrib.Empty() )
467  this->SetSoftnessLimLin( CurrAttrib.AsReal() );
468 
469  CurrAttrib = PropertiesNode.GetAttribute("SoftnessLimAng");
470  if( !CurrAttrib.Empty() )
471  this->SetSoftnessLimAng( CurrAttrib.AsReal() );
472 
473  CurrAttrib = PropertiesNode.GetAttribute("SoftnessOrthoLin");
474  if( !CurrAttrib.Empty() )
475  this->SetSoftnessOrthoLin( CurrAttrib.AsReal() );
476 
477  CurrAttrib = PropertiesNode.GetAttribute("SoftnessOrthoAng");
478  if( !CurrAttrib.Empty() )
479  this->SetSoftnessOrthoAng( CurrAttrib.AsReal() );
480  }else{
481  MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + ( SliderConstraint::GetSerializableName() + "Properties" ) + ": Not Version 1.");
482  }
483  }else{
484  MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_NOT_FOUND_EXCEPTION,SliderConstraint::GetSerializableName() + "Properties" + " was not found in the provided XML node, which was expected.");
485  }
486  }
487 
490 
492  { return "SliderConstraint"; }
493 
494  ///////////////////////////////////////////////////////////////////////////////
495  // Internal
496 
497  btTypedConstraint* SliderConstraint::_GetConstraintBase() const
498  { return this->Slider; }
499  }//Physics
500 }//Mezzanine
501 
502 #endif
virtual Real GetTargetLinMotorVelocity() const
Gets the target velocity of the motor on the linear axis of ths constraint.
virtual void SetSoftnessDirAng(const Real SoftnessDirAng)
Sets the softness value to be used when within the angular limits of this constraint.
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 Vector3 GetPivotALocation() const
Gets the location of the pivot relative to ProxA's Center of gravity.
virtual Real GetSoftnessOrthoLin() const
Gets the softness value to be used when force is applied against the configured linear axis of this c...
A light-weight handle for manipulating attributes in DOM tree.
Definition: attribute.h:74
virtual Constraint::AxisList GetValidAngularAxes() const
Get A list sorted (low to high) of all axis that operate Angularly (that lock sliding/translation) ...
virtual void SetRestitutionLimAng(const Real RestitutionLimAng)
Sets the restitution value to be used when hitting the angular limit of this constraint.
virtual void SetMaxAngMotorForce(const Real MaxAngMotorForce)
Sets the maximum force allowed to be applied on the angular axis of this constraint.
virtual Real GetUpperLinLimit() const
Gets the upper linear limit of this slider.
virtual Boole HasParamBeenSet(ConstraintParam Param, int Axis) const
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 Real GetDampingLimAng() const
Gets the damping value to be used when hitting the angular limit of this constraint.
virtual Real GetRestitutionLimLin() const
Gets the restitution value to be used when hitting the linear limit of this constraint.
bool AsBool(bool def=false) const
Attempts to convert the value of the attribute to a float and returns the results.
virtual Real GetTargetAngMotorVelocity() const
Gets the target velocity of the motor on the angular axis of ths constraint.
virtual void SetDampingLimLin(const Real DampingLimLin)
Sets the damping value to be used when hitting the linear limit of this constraint.
virtual void SetTargetAngMotorVelocity(const Real TargetAngMotorVelocity)
Sets the target velocity of the motor on the angular axis of ths constraint.
virtual Quaternion GetPivotBRotation() const
Gets the relative rotation for ProxB.
virtual void SetSoftnessLimLin(const Real SoftnessLimLin)
Sets the softness value to be used when hitting the linear limit of this constraint.
virtual Real GetDampingDirLin() const
Gets the damping value to be used when within the linear limits of this constraint.
Thrown when the requested identity could not be found.
Definition: exception.h:94
virtual void SetPivotBRotation(const Quaternion &Rotation)
Sets The relative rotation of ProxB.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
Definition: exception.h:3048
virtual Real GetLowerLinLimit() const
Gets the lower linear limit of this slider.
virtual void SetPivotBLocation(const Vector3 &Location)
Sets The relative location of the pivot from ProxB's Center of gravity.
virtual Real GetDampingLimLin() const
Gets the damping value to be used when hitting the linear limit of this constraint.
Thrown when a version is accessed/parsed/required and it cannot work correctly or is missing...
Definition: exception.h:112
virtual void SetPivotBTransform(const Transform &TranB)
Sets the Position and Rotation for the second body using a Transform.
virtual void EnableConstraint(const Boole Enable)
Enables or disables this constraint.
virtual void SetUpperLinLimit(const Real UpperLimit)
Sets the upper linear limit of this slider.
static String GetSerializableName()
Get the name of the the XML tag the class will leave behind as its instances are serialized.
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
virtual void SetSoftnessDirLin(const Real SoftnessDirLin)
Sets the softness value to be used when within the linear limits of this constraint.
bool Empty() const
Is this storing anything at all?
virtual void SetSoftnessLimAng(const Real SoftnessLimAng)
Sets the softness value to be used when hitting the angular limit of this constraint.
virtual Real GetSoftnessDirAng() const
Gets the softness value to be used when within the angular limits of this constraint.
virtual Real GetRestitutionOrthoLin() const
Gets the restitution value to be used when force is applied against the configured linear axis of thi...
virtual Vector3 GetPivotBLocation() const
Gets the location of the pivot relative to ProxB's Center of gravity.
btQuaternion GetBulletQuaternion(Boole normalize=false) const
Gets a Bullet quaternion.
Definition: quaternion.cpp:243
virtual Real GetMaxAngMotorForce() const
Gets the maximum force allowed to be applied on the angular axis of this constraint.
virtual void SetPivotALocation(const Vector3 &Location)
Sets The relative location of the pivot from ProxA's Center of gravity.
virtual void SetDampingLimAng(const Real DampingLimAng)
Sets the damping value to be used when hitting the angular limit of this constraint.
virtual Real GetSoftnessLimLin() const
Gets the softness value to be used when hitting the linear limit of this constraint.
float Real
A Datatype used to represent a real floating point number.
Definition: datatypes.h:141
The interface for serialization.
virtual Real GetLowerAngLimit() const
Gets the lower angular limit of this slider.
virtual Boole GetPoweredLinMotor() const
Gets whether or not the motor for the linear axis of this constraint is enabled.
virtual Real GetSoftnessOrthoAng() const
Gets the softness value to be used when force is applied against the configured angular axis of this ...
bool SetValue(const Char8 *rhs)
Set the value of this.
btSliderConstraint * Slider
Bullet constraint that this class encapsulates.
virtual Real GetDampingDirAng() const
Gets the damping value to be used when within the angular limits of this constraint.
virtual Constraint::AxisList GetValidLinearAxes() const
Get a sorted (low to high) list of all axis that operate linearly (that lock sliding/translation) ...
btTransform GetBulletTransform() const
Gets a Bullet Transform.
Definition: transform.cpp:71
SliderConstraint(const UInt32 ID, RigidProxy *ProxyA, RigidProxy *ProxyB, const Transform &TransA, const Transform &TransB, PhysicsManager *Creator)
Two body Terse constructor.
virtual Real GetSoftnessDirLin() const
Gets the softness value to be used when within the linear limits of 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 Boole GetPoweredAngMotor() const
Gets whether or not the motor for the angular axis of this constraint is enabled. ...
virtual void SetSoftnessOrthoLin(const Real SoftnessOrthoLin)
Sets the softness value to be used when force is applied against the configured linear axis of this c...
virtual void SetUseFrameOffset(const Boole FrameOffset)
Sets whether or not an offset of the constraint frame should be used to calculate internal data...
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 Real GetDampingOrthoAng() const
Gets the damping value to be used when force is applied against the configured angular axis of this c...
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
virtual void SetPivotARotation(const Quaternion &Rotation)
Sets The relative rotation of ProxA.
bool Empty() const
Is this storing anything at all?
virtual void SetRestitutionOrthoLin(const Real RestitutionOrthoLin)
Sets the restitution value to be used when force is applied against the configured linear axis of thi...
virtual String GetDerivedSerializableName() const
Gets the most derived serializable name of this Constraint.
virtual Transform GetPivotBTransform() const
Gets the current Rotation and Location of ProxyB.
virtual btTypedConstraint * _GetConstraintBase() const
Get the Bullet constraint that this class encapsulates.
virtual btRigidBody * _GetPhysicsObject() const
Accessor for the internal rigid body physics proxy.
Definition: rigidproxy.cpp:406
virtual void SetRestitutionDirLin(const Real RestitutionDirLin)
Sets the restitution value to be used when within the linear limits of this constraint.
virtual void SetDampingDirAng(const Real DampingDirAng)
Sets the damping value to be used when within the angular limits of 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...
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 Real GetUpperAngLimit() const
Gets the upper angular limit of this slider.
virtual void SetLowerAngLimit(const Real LowerLimit)
Sets the lower angular limit of this slider.
virtual Real GetRestitutionLimAng() const
Gets the restitution value to be used when hitting the angular limit of this constraint.
virtual void DestroyConstraint()
Destroys the internal constraint.
virtual void SetDampingOrthoLin(const Real DampingOrthoLin)
Sets the damping value to be used when force is applied against the configured linear axis of this co...
virtual ~SliderConstraint()
Class destructor.
This is a proxy from which rigid body proxys are handled.
Definition: rigidproxy.h:102
virtual void SetTargetLinMotorVelocity(const Real TargetLinMotorVelocity)
Sets the target velocity of the motor on the linear axis of ths constraint.
Stores information about relative location and rotation in 3d space.
Definition: transform.h:62
virtual Real GetRestitutionOrthoAng() const
Gets the restitution value to be used when force is applied against the configured angular axis of th...
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.
virtual void SetRestitutionLimLin(const Real RestitutionLimLin)
Sets the restitution value to be used when hitting the linear limit of this constraint.
RigidProxy * ProxA
The first Collidable this constraint applies to.
Definition: constraint.h:130
virtual void SetDampingDirLin(const Real DampingDirLin)
Sets the damping value to be used when within the linear limits of this constraint.
virtual Real GetMaxLinMotorForce() const
Gets the maximum force allowed to be applied on the linear axis of this constraint.
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
virtual void SetPoweredAngMotor(const Boole OnOff)
Sets whether or not the motor for the angular axis of this constraint is enabled. ...
This is used to represent a point in space, or a vector through space.
Definition: vector3.h:77
virtual void SetDampingOrthoAng(const Real DampingOrthoAng)
Sets the damping value to be used when force is applied against the configured angular axis of this c...
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.
Definition: constraint.h:133
virtual void SetPivotTransforms(const Transform &TransA, const Transform &TransB)
Sets the Position and Rotation for the first and second body using a Transform.
virtual Real GetSoftnessLimAng() const
Gets the softness value to be used when hitting the angular limit of this constraint.
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
virtual void SetMaxLinMotorForce(const Real MaxLinMotorForce)
Sets the maximum force allowed to be applied on the linear axis of this constraint.
virtual Transform GetPivotATransform() const
Gets the current Rotation and Location of ProxyA.
virtual void SetRestitutionOrthoAng(const Real RestitutionOrthoAng)
Sets the restitution value to be used when force is applied against the configured angular axis of th...
This is used to store information about rotation in 3d space.
Definition: quaternion.h:68
virtual void SetPoweredLinMotor(const Boole OnOff)
Sets whether or not the motor for the linear axis of this constraint is enabled.
virtual void SetLowerLinLimit(const Real LowerLimit)
Sets the lower linear limit of this slider.
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 void SetUpperAngLimit(const Real UpperLimit)
Sets the upper angular limit of this slider.
std::string String
A datatype used to a series of characters.
Definition: datatypes.h:159
virtual Constraint::ParamList GetValidParamsOnAxis(int Axis) const
Get a sorted (low to high) list of Parameters that are valid on this Axis.
virtual void CreateConstraint(RigidProxy *RigidA, RigidProxy *RigidB, const Transform &TransA, const Transform &TransB)
Creates the internal constraint.
virtual void SetPivotATransform(const Transform &TranA)
Sets the Position and Rotation for the first body using a Transform.
Attribute GetAttribute(const Char8 *Name) const
Attempt to get an Attribute on this Node with a given name.
virtual Real GetDampingOrthoLin() const
Gets the damping value to be used when force is applied against the configured linear axis of this co...
virtual Real GetRestitutionDirAng() const
Gets the restitution value to be used when within the angular limits of this constraint.
virtual Real GetRestitutionDirLin() const
Gets the restitution value to be used when within the linear limits of this constraint.
virtual void SetRestitutionDirAng(const Real RestitutionDirAng)
Sets the restitution value to be used when within the angular limits of this constraint.
virtual Boole GetUseFrameOffset() const
Gets whether or not an offset of the constraint frame should be used to calculate internal data...
Node GetChild(const Char8 *Name) const
Attempt to get a child Node with a given name.
virtual Quaternion GetPivotARotation() const
Gets the relative rotation for ProxA.
virtual void SetSoftnessOrthoAng(const Real SoftnessOrthoAng)
Sets the softness value to be used when force is applied against the configured angular axis of this ...