4 #include "jointhinge.h"
11 JointHinge::JointHinge(void) : Joint(){}
14 JointHinge::JointHinge(World
&world
)
16 if(this->_id
) dJointDestroy(this->_id
);
17 _id
= dJointCreateHinge(world
.Id(), 0);
21 JointHinge::JointHinge(World
&world
, JointGroup
&jointGroup
)
23 if(this->_id
) dJointDestroy(this->_id
);
24 _id
= dJointCreateHinge(world
.Id(), jointGroup
.Id());
30 JointHinge::~JointHinge(void){}
36 void JointHinge::Create(World
&world
, JointGroup
&jointGroup
)
38 if(this->_id
) dJointDestroy(this->_id
);
39 _id
= dJointCreateHinge(world
.Id(), jointGroup
.Id());
42 void JointHinge::Create(World
&world
)
44 if(this->_id
) dJointDestroy(this->_id
);
45 _id
= dJointCreateHinge(world
.Id(), 0);
50 void JointHinge::Attach(Body
&body1
, Body
&body2
)
52 dJointAttach(this->_id
, body1
.Id(), body2
.Id());
55 void JointHinge::Attach(Body
&body1
)
57 dJointAttach(this->_id
, body1
.Id(), 0);
62 void JointHinge::SetAxis(double x
, double y
, double z
)
64 dJointSetHingeAxis(this->_id
, x
, y
, z
);
68 Vector3
JointHinge::GetAxis(void)
72 dJointGetHingeAxis(this->_id
, temp
);
81 void JointHinge::SetAnchor(double x
, double y
, double z
)
83 dJointSetHingeAnchor(this->_id
, x
, y
, z
);
87 Vector3
JointHinge::GetAnchor(void)
91 dJointGetHingeAnchor(this->_id
, temp
);
102 void JointHinge::SetAllMovParams(double LoStop
, double HiStop
,
103 double Velocity
, double MaxForce
,
104 double FudgeFactor
, double Bounce
,
105 double StopERP
, double StopCFM
)
107 if (LoStop
> -3.141592653 && LoStop
<= 0)
108 dJointSetHingeParam(this->_id
, dParamLoStop
, LoStop
);
110 if (HiStop
< 3.141592653 && HiStop
>= 0)
111 dJointSetHingeParam(this->_id
, dParamHiStop
, HiStop
);
113 dJointSetHingeParam(this->_id
, dParamVel
, Velocity
);
114 dJointSetHingeParam(this->_id
, dParamFMax
, MaxForce
);
115 dJointSetHingeParam(this->_id
, dParamFudgeFactor
, FudgeFactor
);
116 dJointSetHingeParam(this->_id
, dParamBounce
, Bounce
);
117 dJointSetHingeParam(this->_id
, dParamStopERP
, StopERP
);
118 dJointSetHingeParam(this->_id
, dParamStopCFM
, StopCFM
);