aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ode-0.9/contrib/DotNetManaged/JointAMotor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ode-0.9/contrib/DotNetManaged/JointAMotor.cpp')
-rw-r--r--libraries/ode-0.9/contrib/DotNetManaged/JointAMotor.cpp162
1 files changed, 162 insertions, 0 deletions
diff --git a/libraries/ode-0.9/contrib/DotNetManaged/JointAMotor.cpp b/libraries/ode-0.9/contrib/DotNetManaged/JointAMotor.cpp
new file mode 100644
index 0000000..c5a4543
--- /dev/null
+++ b/libraries/ode-0.9/contrib/DotNetManaged/JointAMotor.cpp
@@ -0,0 +1,162 @@
1#include "StdAfx.h"
2
3#include <ode/ode.h>
4#include "JointAMotor.h"
5
6namespace ODEManaged
7{
8
9 //Constructors
10
11 JointAMotor::JointAMotor(void) : Joint(){}
12
13
14 JointAMotor::JointAMotor(World &world)
15 {
16 if(this->_id) dJointDestroy(this->_id);
17 _id = dJointCreateAMotor(world.Id(), 0);
18 }
19
20
21 JointAMotor::JointAMotor(World &world, JointGroup &jointGroup)
22 {
23 if(this->_id) dJointDestroy(this->_id);
24 _id = dJointCreateAMotor(world.Id(), jointGroup.Id());
25 }
26
27
28 //Destructor
29
30 JointAMotor::~JointAMotor(void){}
31
32
33 //Methods
34
35 //Overloaded Create
36 void JointAMotor::Create(World &world, JointGroup &jointGroup)
37 {
38 if(this->_id) dJointDestroy(this->_id);
39 _id = dJointCreateAMotor(world.Id(), jointGroup.Id());
40 }
41
42 void JointAMotor::Create(World &world)
43 {
44 if(this->_id) dJointDestroy(this->_id);
45 _id = dJointCreateAMotor(world.Id(), 0);
46 }
47
48
49 //Overloaded Attach
50 void JointAMotor::Attach(Body &body1, Body &body2)
51 {
52 dJointAttach(this->_id, body1.Id(), body2.Id());
53 }
54
55 void JointAMotor::Attach(Body &body1)
56 {
57 dJointAttach(this->_id, body1.Id(), 0);
58 }
59
60
61 //SetNumAxes
62
63 void JointAMotor::SetNumAxes(int num)
64 {
65 dJointSetAMotorNumAxes(this->_id, num);
66 }
67
68
69 //GetNumAxes
70
71 int JointAMotor::GetNumAxes(void)
72 {
73 return dJointGetAMotorNumAxes(this->_id);
74 }
75
76
77 //SetAxis
78
79 void JointAMotor::SetAxis(int anum, int rel, double x, double y ,double z)
80 {
81 dJointSetAMotorAxis(this->_id, anum, rel, x, y, z);
82 }
83
84
85 //GetAxis
86
87 Vector3 JointAMotor::GetAxis(int anum)
88 {
89 Vector3 retVal;
90 dVector3 temp;
91 dJointGetAMotorAxis(this->_id, anum, temp);
92 retVal.x = temp[0];
93 retVal.y = temp[1];
94 retVal.z = temp[2];
95 return retVal;
96 }
97
98
99 //SetAngle
100
101 void JointAMotor::SetAngle(int anum, double angle)
102 {
103 dJointSetAMotorAngle(this->_id, anum, angle);
104 }
105
106
107 //GetAngle
108
109 double JointAMotor::GetAngle(int anum)
110 {
111 return dJointGetAMotorAngle(this->_id, anum);
112 }
113
114
115 //SetParam
116
117 void JointAMotor::SetParam(int parameter, double value)
118 {
119 dJointSetAMotorParam(this->_id, parameter, value);
120 }
121
122
123 //GetParam
124
125 double JointAMotor::GetParam(int parameter)
126 {
127 return dJointGetAMotorParam(this->_id, parameter);
128 }
129
130
131 //SetMode
132
133 void JointAMotor::SetMode(int mode)
134 {
135 dJointSetAMotorMode(this->_id, mode);
136 }
137
138
139 //GetMode
140
141 int JointAMotor::GetMode(void)
142 {
143 return dJointGetAMotorMode(this->_id);
144 }
145
146
147 //GetAxisRel
148
149 int JointAMotor::GetAxisRel(int anum)
150 {
151 return dJointGetAMotorAxisRel(this->_id, anum);
152 }
153
154
155 //GetAngleRate
156
157 double JointAMotor::GetAngleRate(int anum)
158 {
159 return dJointGetAMotorAngleRate(this->_id, anum);
160 }
161
162}