AnimatLab  2
Test
BlPrismaticLimit.cpp
1 
2 #include "StdAfx.h"
3 #include "BlJoint.h"
4 #include "BlMotorizedJoint.h"
5 #include "BlRigidBody.h"
6 #include "BlPrismaticLimit.h"
7 #include "BlPrismatic.h"
8 #include "BlSimulator.h"
9 
10 namespace BulletAnimatSim
11 {
12  namespace Environment
13  {
14  namespace Joints
15  {
16 
17 BlPrismaticLimit::BlPrismaticLimit()
18 {
19  OsgPrismaticLimit::SetConstraintLimit(this);
20 }
21 
22 BlPrismaticLimit::~BlPrismaticLimit()
23 {
24 }
25 
26 void BlPrismaticLimit::Alpha(float fltA)
27 {
28  m_vColor.a(fltA);
29 
30  OsgPrismaticLimit::LimitAlpha(fltA);
31 }
32 
34 {
35  CStdFPoint vPos(0, 0, 0), vRot(0, 0, 0);
36 
37  Prismatic *lpPrismatic = dynamic_cast<Prismatic *>(m_lpJoint);
38  if(lpPrismatic)
39  OsgPrismaticLimit::SetLimitPos(lpPrismatic->CylinderRadius());
40 
41  //Set the limit on the physics Prismatic object.
43 }
44 
46 {
47  BlPrismatic *lpPrismatic = dynamic_cast<BlPrismatic *>(m_lpJoint);
48 
49  //Do not want to call this repeatedly if we are the flap limit.
50  if(lpPrismatic && !m_bIsShowPosition)
51  lpPrismatic->SetLimitValues();
52 }
53 
55 {
56  OsgPrismaticLimit::DeleteLimitGraphics();
57 }
58 
60 {
61  //The parent osg object for the joint is actually the child rigid body object.
62  Prismatic *lpPrismatic = dynamic_cast<Prismatic *>(m_lpJoint);
63 
64  if(lpPrismatic)
65  OsgPrismaticLimit::SetupLimitGraphics(lpPrismatic->BoxSize(), lpPrismatic->CylinderRadius());
66 }
67 
68  } //Bodies
69  } // Environment
70 } //BulletAnimatSim
Declares the vs prismatic class.
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.
virtual void DeleteGraphics()
Deletes up the graphics for the constraint.
virtual void SetLimitPos()
Sets the limit position using the current value set within the object.
CStdColor m_vColor
The color used to display the limit.
virtual void SetLimitValues()
Sets the limit values of the joint in the child object.