aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ode-0.9\/contrib/DotNetManaged/JointAMotor.cpp
blob: c5a4543ca5e67463cdd81890c2a594800aacff95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#include "StdAfx.h"

#include <ode/ode.h>
#include "JointAMotor.h"

namespace ODEManaged
{

	//Constructors

		JointAMotor::JointAMotor(void) : Joint(){}


		JointAMotor::JointAMotor(World &world)
		{
			if(this->_id) dJointDestroy(this->_id);
			_id = dJointCreateAMotor(world.Id(), 0);
		}

		
		JointAMotor::JointAMotor(World &world, JointGroup &jointGroup)
		{
			if(this->_id) dJointDestroy(this->_id);
			_id = dJointCreateAMotor(world.Id(), jointGroup.Id());
		}


	//Destructor

		JointAMotor::~JointAMotor(void){}


	//Methods

		//Overloaded Create 
			void JointAMotor::Create(World &world, JointGroup &jointGroup)
			{
				if(this->_id) dJointDestroy(this->_id);
				_id = dJointCreateAMotor(world.Id(), jointGroup.Id());
			}

			void JointAMotor::Create(World &world)
			{
				if(this->_id) dJointDestroy(this->_id);
				_id = dJointCreateAMotor(world.Id(), 0);
			}


		//Overloaded Attach
			void JointAMotor::Attach(Body &body1, Body &body2)
			{
				dJointAttach(this->_id, body1.Id(), body2.Id());
			}

			void JointAMotor::Attach(Body &body1)
			{
				dJointAttach(this->_id, body1.Id(), 0);
			}


		//SetNumAxes

			void JointAMotor::SetNumAxes(int num)
			{
				dJointSetAMotorNumAxes(this->_id, num);
			}


		//GetNumAxes

			int JointAMotor::GetNumAxes(void)
			{
				return dJointGetAMotorNumAxes(this->_id);
			}


		//SetAxis

			void JointAMotor::SetAxis(int anum, int rel, double x, double y ,double z)
			{
				dJointSetAMotorAxis(this->_id, anum, rel, x, y, z);
			}


		//GetAxis

			Vector3 JointAMotor::GetAxis(int anum)
			{
				Vector3 retVal;
				dVector3 temp;
				dJointGetAMotorAxis(this->_id, anum, temp);
				retVal.x = temp[0];
				retVal.y = temp[1];
				retVal.z = temp[2];
				return retVal;
			}


		//SetAngle

			void JointAMotor::SetAngle(int anum, double angle)
			{
				dJointSetAMotorAngle(this->_id, anum, angle);
			}


		//GetAngle

			double JointAMotor::GetAngle(int anum)
			{
				return dJointGetAMotorAngle(this->_id, anum);
			}


		//SetParam

			void JointAMotor::SetParam(int parameter, double value)
			{
				dJointSetAMotorParam(this->_id, parameter, value);
			}


		//GetParam

			double JointAMotor::GetParam(int parameter)
			{
				return dJointGetAMotorParam(this->_id, parameter);
			}


		//SetMode

			void JointAMotor::SetMode(int mode)
			{
				dJointSetAMotorMode(this->_id, mode);
			}


		//GetMode

			int JointAMotor::GetMode(void)
			{
				return dJointGetAMotorMode(this->_id);
			}


		//GetAxisRel

			int JointAMotor::GetAxisRel(int anum)
			{
				return dJointGetAMotorAxisRel(this->_id, anum);
			}


		//GetAngleRate

			double JointAMotor::GetAngleRate(int anum)
			{
				return dJointGetAMotorAngleRate(this->_id, anum);
			}

}