Panda3D
Loading...
Searching...
No Matches
bulletManifoldPoint.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file bulletManifoldPoint.cxx
10 * @author enn0x
11 * @date 2010-03-07
12 */
13
14#include "bulletManifoldPoint.h"
15
16#include "bulletWorld.h"
17
18/**
19 *
20 */
21BulletManifoldPoint::
22BulletManifoldPoint(btManifoldPoint &pt)
23 : _pt(pt) {
24
25}
26
27/**
28 *
29 */
30BulletManifoldPoint::
31BulletManifoldPoint(const BulletManifoldPoint &other)
32 : _pt(other._pt) {
33
34}
35
36/**
37 *
38 */
39BulletManifoldPoint& BulletManifoldPoint::
40operator=(const BulletManifoldPoint& other) {
41
42 this->_pt = other._pt;
43 return *this;
44}
45
46/**
47 *
48 */
49int BulletManifoldPoint::
50get_life_time() const {
51 LightMutexHolder holder(BulletWorld::get_global_lock());
52
53 return _pt.getLifeTime();
54}
55
56/**
57 *
58 */
59PN_stdfloat BulletManifoldPoint::
60get_distance() const {
61 LightMutexHolder holder(BulletWorld::get_global_lock());
62
63 return (PN_stdfloat)_pt.getDistance();
64}
65
66/**
67 *
68 */
69PN_stdfloat BulletManifoldPoint::
70get_applied_impulse() const {
71 LightMutexHolder holder(BulletWorld::get_global_lock());
72
73 return (PN_stdfloat)_pt.getAppliedImpulse();
74}
75
76/**
77 *
78 */
79LPoint3 BulletManifoldPoint::
80get_position_world_on_a() const {
81 LightMutexHolder holder(BulletWorld::get_global_lock());
82
83 return btVector3_to_LPoint3(_pt.getPositionWorldOnA());
84}
85
86/**
87 *
88 */
89LPoint3 BulletManifoldPoint::
90get_position_world_on_b() const {
91 LightMutexHolder holder(BulletWorld::get_global_lock());
92
93 return btVector3_to_LPoint3(_pt.getPositionWorldOnB());
94}
95
96/**
97 *
98 */
99LVector3 BulletManifoldPoint::
100get_normal_world_on_b() const {
101 LightMutexHolder holder(BulletWorld::get_global_lock());
102
103 return btVector3_to_LVector3(_pt.m_normalWorldOnB);
104}
105
106/**
107 *
108 */
109LPoint3 BulletManifoldPoint::
110get_local_point_a() const {
111 LightMutexHolder holder(BulletWorld::get_global_lock());
112
113 return btVector3_to_LPoint3(_pt.m_localPointA);
114}
115
116/**
117 *
118 */
119LPoint3 BulletManifoldPoint::
120get_local_point_b() const {
121 LightMutexHolder holder(BulletWorld::get_global_lock());
122
123 return btVector3_to_LPoint3(_pt.m_localPointB);
124}
125
126/**
127 *
128 */
129int BulletManifoldPoint::
130get_part_id0() const {
131 LightMutexHolder holder(BulletWorld::get_global_lock());
132
133 return _pt.m_partId0;
134}
135
136/**
137 *
138 */
139int BulletManifoldPoint::
140get_part_id1() const {
141 LightMutexHolder holder(BulletWorld::get_global_lock());
142
143 return _pt.m_partId1;
144}
145
146/**
147 *
148 */
149int BulletManifoldPoint::
150get_index0() const {
151 LightMutexHolder holder(BulletWorld::get_global_lock());
152
153 return _pt.m_index0;
154}
155
156/**
157 *
158 */
159int BulletManifoldPoint::
160get_index1() const {
161 LightMutexHolder holder(BulletWorld::get_global_lock());
162
163 return _pt.m_index1;
164}
165
166/**
167 *
168 */
169void BulletManifoldPoint::
170set_lateral_friction_initialized(bool value) {
171 LightMutexHolder holder(BulletWorld::get_global_lock());
172
173#if BT_BULLET_VERSION >= 285
174 if (value) {
175 _pt.m_contactPointFlags |= BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED;
176 } else {
177 _pt.m_contactPointFlags &= ~BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED;
178 }
179#else
180 _pt.m_lateralFrictionInitialized = value;
181#endif
182}
183
184/**
185 *
186 */
187bool BulletManifoldPoint::
188get_lateral_friction_initialized() const {
189 LightMutexHolder holder(BulletWorld::get_global_lock());
190
191#if BT_BULLET_VERSION >= 285
192 return (_pt.m_contactPointFlags & BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED) != 0;
193#else
194 return _pt.m_lateralFrictionInitialized;
195#endif
196}
197
198/**
199 *
200 */
201void BulletManifoldPoint::
202set_lateral_friction_dir1(const LVecBase3 &dir) {
203 LightMutexHolder holder(BulletWorld::get_global_lock());
204
205 _pt.m_lateralFrictionDir1 = LVecBase3_to_btVector3(dir);
206}
207
208/**
209 *
210 */
211LVector3 BulletManifoldPoint::
212get_lateral_friction_dir1() const {
213 LightMutexHolder holder(BulletWorld::get_global_lock());
214
215 return btVector3_to_LVector3(_pt.m_lateralFrictionDir1);
216}
217
218/**
219 *
220 */
221void BulletManifoldPoint::
222set_lateral_friction_dir2(const LVecBase3 &dir) {
223 LightMutexHolder holder(BulletWorld::get_global_lock());
224
225 _pt.m_lateralFrictionDir2 = LVecBase3_to_btVector3(dir);
226}
227
228/**
229 *
230 */
231LVector3 BulletManifoldPoint::
232get_lateral_friction_dir2() const {
233 LightMutexHolder holder(BulletWorld::get_global_lock());
234
235 return btVector3_to_LVector3(_pt.m_lateralFrictionDir2);
236}
237
238/**
239 *
240 */
241void BulletManifoldPoint::
242set_contact_motion1(PN_stdfloat value) {
243 LightMutexHolder holder(BulletWorld::get_global_lock());
244
245 _pt.m_contactMotion1 = (btScalar)value;
246}
247
248/**
249 *
250 */
251PN_stdfloat BulletManifoldPoint::
252get_contact_motion1() const {
253 LightMutexHolder holder(BulletWorld::get_global_lock());
254
255 return (PN_stdfloat)_pt.m_contactMotion1;
256}
257
258/**
259 *
260 */
261void BulletManifoldPoint::
262set_contact_motion2(PN_stdfloat value) {
263 LightMutexHolder holder(BulletWorld::get_global_lock());
264
265 _pt.m_contactMotion2 = (btScalar)value;
266}
267
268/**
269 *
270 */
271PN_stdfloat BulletManifoldPoint::
272get_contact_motion2() const {
273 LightMutexHolder holder(BulletWorld::get_global_lock());
274
275 return (PN_stdfloat)_pt.m_contactMotion2;
276}
277
278/**
279 *
280 */
281void BulletManifoldPoint::
282set_combined_friction(PN_stdfloat value) {
283 LightMutexHolder holder(BulletWorld::get_global_lock());
284
285 _pt.m_combinedFriction = (btScalar)value;
286}
287
288/**
289 *
290 */
291PN_stdfloat BulletManifoldPoint::
292get_combined_friction() const {
293 LightMutexHolder holder(BulletWorld::get_global_lock());
294
295 return (PN_stdfloat)_pt.m_combinedFriction;
296}
297
298/**
299 *
300 */
301void BulletManifoldPoint::
302set_combined_restitution(PN_stdfloat value) {
303 LightMutexHolder holder(BulletWorld::get_global_lock());
304
305 _pt.m_combinedRestitution = (btScalar)value;
306}
307
308/**
309 *
310 */
311PN_stdfloat BulletManifoldPoint::
312get_combined_restitution() const {
313 LightMutexHolder holder(BulletWorld::get_global_lock());
314
315 return (PN_stdfloat)_pt.m_combinedRestitution;
316}
317
318/**
319 *
320 */
321void BulletManifoldPoint::
322set_applied_impulse(PN_stdfloat value) {
323 LightMutexHolder holder(BulletWorld::get_global_lock());
324
325 _pt.m_appliedImpulse = (btScalar)value;
326}
327
328/**
329 *
330 */
331void BulletManifoldPoint::
332set_applied_impulse_lateral1(PN_stdfloat value) {
333 LightMutexHolder holder(BulletWorld::get_global_lock());
334
335 _pt.m_appliedImpulseLateral1 = (btScalar)value;
336}
337
338/**
339 *
340 */
341PN_stdfloat BulletManifoldPoint::
342get_applied_impulse_lateral1() const {
343 LightMutexHolder holder(BulletWorld::get_global_lock());
344
345 return (PN_stdfloat)_pt.m_appliedImpulseLateral1;
346}
347
348/**
349 *
350 */
351void BulletManifoldPoint::
352set_applied_impulse_lateral2(PN_stdfloat value) {
353 LightMutexHolder holder(BulletWorld::get_global_lock());
354
355 _pt.m_appliedImpulseLateral2 = (btScalar)value;
356}
357
358/**
359 *
360 */
361PN_stdfloat BulletManifoldPoint::
362get_applied_impulse_lateral2() const {
363 LightMutexHolder holder(BulletWorld::get_global_lock());
364
365 return (PN_stdfloat)_pt.m_appliedImpulseLateral2;
366}
367
368/**
369 *
370 */
371void BulletManifoldPoint::
372set_contact_cfm1(PN_stdfloat value) {
373 LightMutexHolder holder(BulletWorld::get_global_lock());
374
375#if BT_BULLET_VERSION < 285
376 _pt.m_contactCFM1 = (btScalar)value;
377#endif
378}
379
380/**
381 *
382 */
383PN_stdfloat BulletManifoldPoint::
384get_contact_cfm1() const {
385 LightMutexHolder holder(BulletWorld::get_global_lock());
386
387#if BT_BULLET_VERSION < 285
388 return (PN_stdfloat)_pt.m_contactCFM1;
389#else
390 return 0;
391#endif
392}
393
394/**
395 *
396 */
397void BulletManifoldPoint::
398set_contact_cfm2(PN_stdfloat value) {
399 LightMutexHolder holder(BulletWorld::get_global_lock());
400
401#if BT_BULLET_VERSION < 285
402 _pt.m_contactCFM2 = (btScalar)value;
403#endif
404}
405
406/**
407 *
408 */
409PN_stdfloat BulletManifoldPoint::
410get_contact_cfm2() const {
411 LightMutexHolder holder(BulletWorld::get_global_lock());
412
413#if BT_BULLET_VERSION < 285
414 return (PN_stdfloat)_pt.m_contactCFM2;
415#else
416 return 0;
417#endif
418}
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Similar to MutexHolder, but for a light mutex.