Panda3D
bulletTranslationalLimitMotor.I
1 // Filename: bulletTranslationalLimitMotor.I
2 // Created by: enn0x (03Mar13)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: BulletTranslationalLimitMotor::is_limited
18 // Access: Published
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE bool BulletTranslationalLimitMotor::
22 is_limited(int axis) const {
23 
24  nassertr((0 <= axis) && (axis <= 2), false);
25  return _motor.isLimited(axis);
26 }
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function: BulletTranslationalLimitMotor::set_motor_enabled
30 // Access: Published
31 // Description:
32 ////////////////////////////////////////////////////////////////////
33 INLINE void BulletTranslationalLimitMotor::
34 set_motor_enabled(int axis, bool enabled) {
35 
36  nassertv((0 <= axis) && (axis <= 2));
37  _motor.m_enableMotor[axis] = enabled;
38 }
39 
40 ////////////////////////////////////////////////////////////////////
41 // Function: BulletTranslationalLimitMotor::get_motor_enabled
42 // Access: Published
43 // Description:
44 ////////////////////////////////////////////////////////////////////
45 INLINE bool BulletTranslationalLimitMotor::
46 get_motor_enabled(int axis) const {
47 
48  nassertr((0 <= axis) && (axis <= 2), false);
49  return _motor.m_enableMotor[axis];
50 }
51 
52 ////////////////////////////////////////////////////////////////////
53 // Function: BulletTranslationalLimitMotor::set_low_limit
54 // Access: Published
55 // Description:
56 ////////////////////////////////////////////////////////////////////
57 INLINE void BulletTranslationalLimitMotor::
58 set_low_limit(const LVecBase3 &limit) {
59 
60  nassertv(!limit.is_nan());
61  _motor.m_lowerLimit = LVecBase3_to_btVector3(limit);
62 }
63 
64 ////////////////////////////////////////////////////////////////////
65 // Function: BulletTranslationalLimitMotor::set_high_limit
66 // Access: Published
67 // Description:
68 ////////////////////////////////////////////////////////////////////
69 INLINE void BulletTranslationalLimitMotor::
70 set_high_limit(const LVecBase3 &limit) {
71 
72  nassertv(!limit.is_nan());
73  _motor.m_upperLimit = LVecBase3_to_btVector3(limit);
74 }
75 
76 ////////////////////////////////////////////////////////////////////
77 // Function: BulletTranslationalLimitMotor::set_target_velocity
78 // Access: Published
79 // Description:
80 ////////////////////////////////////////////////////////////////////
81 INLINE void BulletTranslationalLimitMotor::
82 set_target_velocity(const LVecBase3 &velocity) {
83 
84  nassertv(!velocity.is_nan());
85  _motor.m_targetVelocity = LVecBase3_to_btVector3(velocity);
86 }
87 
88 ////////////////////////////////////////////////////////////////////
89 // Function: BulletTranslationalLimitMotor::set_max_motor_force
90 // Access: Published
91 // Description:
92 ////////////////////////////////////////////////////////////////////
93 INLINE void BulletTranslationalLimitMotor::
94 set_max_motor_force(const LVecBase3 &force) {
95 
96  nassertv(!force.is_nan());
97  _motor.m_maxMotorForce = LVecBase3_to_btVector3(force);
98 }
99 
100 ////////////////////////////////////////////////////////////////////
101 // Function: BulletTranslationalLimitMotor::set_damping
102 // Access: Published
103 // Description:
104 ////////////////////////////////////////////////////////////////////
105 INLINE void BulletTranslationalLimitMotor::
106 set_damping(PN_stdfloat damping) {
107 
108  _motor.m_damping = (btScalar)damping;
109 }
110 
111 ////////////////////////////////////////////////////////////////////
112 // Function: BulletTranslationalLimitMotor::set_softness
113 // Access: Published
114 // Description:
115 ////////////////////////////////////////////////////////////////////
116 INLINE void BulletTranslationalLimitMotor::
117 set_softness(PN_stdfloat softness) {
118 
119  _motor.m_limitSoftness = (btScalar)softness;
120 }
121 
122 ////////////////////////////////////////////////////////////////////
123 // Function: BulletTranslationalLimitMotor::set_restitution
124 // Access: Published
125 // Description:
126 ////////////////////////////////////////////////////////////////////
127 INLINE void BulletTranslationalLimitMotor::
128 set_restitution(PN_stdfloat restitution) {
129 
130  _motor.m_restitution = (btScalar)restitution;
131 }
132 
133 ////////////////////////////////////////////////////////////////////
134 // Function: BulletTranslationalLimitMotor::set_normal_cfm
135 // Access: Published
136 // Description:
137 ////////////////////////////////////////////////////////////////////
138 INLINE void BulletTranslationalLimitMotor::
139 set_normal_cfm(const LVecBase3 &cfm) {
140 
141  nassertv(!cfm.is_nan());
142  _motor.m_normalCFM = LVecBase3_to_btVector3(cfm);
143 }
144 
145 ////////////////////////////////////////////////////////////////////
146 // Function: BulletTranslationalLimitMotor::set_stop_cfm
147 // Access: Published
148 // Description:
149 ////////////////////////////////////////////////////////////////////
150 INLINE void BulletTranslationalLimitMotor::
151 set_stop_cfm(const LVecBase3 &cfm) {
152 
153  nassertv(!cfm.is_nan());
154  _motor.m_stopCFM = LVecBase3_to_btVector3(cfm);
155 }
156 
157 ////////////////////////////////////////////////////////////////////
158 // Function: BulletTranslationalLimitMotor::set_stop_erp
159 // Access: Published
160 // Description:
161 ////////////////////////////////////////////////////////////////////
162 INLINE void BulletTranslationalLimitMotor::
163 set_stop_erp(const LVecBase3 &erp) {
164 
165  nassertv(!erp.is_nan());
166  _motor.m_stopERP = LVecBase3_to_btVector3(erp);
167 }
168 
169 ////////////////////////////////////////////////////////////////////
170 // Function: BulletTranslationalLimitMotor::get_current_limit
171 // Access: Published
172 // Description: Retrieves the current value of angle:
173 // 0 = free,
174 // 1 = at low limit,
175 // 2 = at high limit.
176 ////////////////////////////////////////////////////////////////////
178 get_current_limit(int axis) const {
179 
180  nassertr((0 <= axis) && (axis <= 2), false);
181  return _motor.m_currentLimit[axis];
182 }
183 
184 ////////////////////////////////////////////////////////////////////
185 // Function: BulletTranslationalLimitMotor::get_current_error
186 // Access: Published
187 // Description:
188 ////////////////////////////////////////////////////////////////////
189 INLINE LVector3 BulletTranslationalLimitMotor::
190 get_current_error() const {
191 
192  return btVector3_to_LVector3(_motor.m_currentLimitError);
193 }
194 
195 ////////////////////////////////////////////////////////////////////
196 // Function: BulletTranslationalLimitMotor::get_current_diff
197 // Access: Published
198 // Description:
199 ////////////////////////////////////////////////////////////////////
200 INLINE LPoint3 BulletTranslationalLimitMotor::
201 get_current_diff() const {
202 
203  return btVector3_to_LPoint3(_motor.m_currentLinearDiff);
204 }
205 
206 ////////////////////////////////////////////////////////////////////
207 // Function: BulletTranslationalLimitMotor::get_accumulated_impulse
208 // Access: Published
209 // Description:
210 ////////////////////////////////////////////////////////////////////
211 INLINE LVector3 BulletTranslationalLimitMotor::
212 get_accumulated_impulse() const {
213 
214  return btVector3_to_LVector3(_motor.m_accumulatedImpulse);
215 }
216 
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:105
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:100
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
bool is_nan() const
Returns true if any component of the vector is not-a-number, false otherwise.
Definition: lvecBase3.h:464
int get_current_limit(int axis) const
Retrieves the current value of angle: 0 = free, 1 = at low limit, 2 = at high limit.