AnimatLab  2
Test
BlHingeLimit.cpp
1 
2 #include "StdAfx.h"
3 #include "BlJoint.h"
4 #include "BlMotorizedJoint.h"
5 #include "BlRigidBody.h"
6 #include "BlHinge.h"
7 #include "BlHingeLimit.h"
8 #include "BlSimulator.h"
9 
10 namespace BulletAnimatSim
11 {
12  namespace Environment
13  {
14  namespace Joints
15  {
16 
17 BlHingeLimit::BlHingeLimit()
18 {
19  OsgHingeLimit::SetConstraintLimit(this);
20 }
21 
22 BlHingeLimit::~BlHingeLimit()
23 {
24 }
25 
26 void BlHingeLimit::Alpha(float fltA)
27 {
28  m_vColor.a(fltA);
29 
30  OsgHingeLimit::LimitAlpha(fltA);
31 }
32 
34 {
35  Hinge *lpHinge = dynamic_cast<Hinge *>(m_lpJoint);
36 
37  if(lpHinge)
38  OsgHingeLimit::SetLimitPos(lpHinge->CylinderHeight());
39 
40  //Set the limit on the physics hinge object.
42 }
43 
45 {
46  BlHinge *lpHinge = dynamic_cast<BlHinge *>(m_lpJoint);
47 
48  //Do not want to call this repeatedly if we are the flap limit.
49  if(lpHinge && !m_bIsShowPosition)
50  lpHinge->SetLimitValues();
51 }
52 
54 {
55  OsgHingeLimit::DeleteLimitGraphics();
56 }
57 
59 {
60  //The parent osg object for the joint is actually the child rigid body object.
61  Hinge *lpHinge = dynamic_cast<Hinge *>(m_lpJoint);
62 
63  if(lpHinge)
64  OsgHingeLimit::SetupLimitGraphics(lpHinge->FlapWidth(), lpHinge->CylinderHeight());
65 }
66 
67  } //Bodies
68  } // Environment
69 } //BulletAnimatSim
Declares the vortex hinge class.
virtual void SetLimitPos()
Sets the limit position using the current value set within the object.
virtual void SetupGraphics()
Sets up the graphics for the constraint.
virtual float Alpha()
Gets the alpha value.
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
Joint * m_lpJoint
Pointer to parent joint.
Vortex hinge joint class.
Definition: BlHinge.h:32
virtual void DeleteGraphics()
Deletes up the graphics for the constraint.
virtual void SetLimitValues()
Sets the limit values of the joint in the child object.
CStdColor m_vColor
The color used to display the limit.