Panda3D
Loading...
Searching...
No Matches
bulletRotationalLimitMotor.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 bulletRotationalLimitMotor.cxx
10 * @author enn0x
11 * @date 2013-03-03
12 */
13
15
16#include "bulletWorld.h"
17
18/**
19 *
20 */
21BulletRotationalLimitMotor::
22BulletRotationalLimitMotor(btRotationalLimitMotor &motor)
23 : _motor(motor) {
24
25}
26
27/**
28 *
29 */
30BulletRotationalLimitMotor::
31BulletRotationalLimitMotor(const BulletRotationalLimitMotor &copy)
32 : _motor(copy._motor) {
33
34}
35
36/**
37 *
38 */
39bool BulletRotationalLimitMotor::
40is_limited() const {
41 LightMutexHolder holder(BulletWorld::get_global_lock());
42
43 return _motor.isLimited();
44}
45
46/**
47 *
48 */
49void BulletRotationalLimitMotor::
50set_motor_enabled(bool enabled) {
51 LightMutexHolder holder(BulletWorld::get_global_lock());
52
53 _motor.m_enableMotor = enabled;
54}
55
56/**
57 *
58 */
59bool BulletRotationalLimitMotor::
60get_motor_enabled() const {
61 LightMutexHolder holder(BulletWorld::get_global_lock());
62
63 return _motor.m_enableMotor;
64}
65/**
66 *
67 */
68void BulletRotationalLimitMotor::
69set_low_limit(PN_stdfloat limit) {
70 LightMutexHolder holder(BulletWorld::get_global_lock());
71
72 _motor.m_loLimit = (btScalar)limit;
73}
74
75/**
76 *
77 */
78void BulletRotationalLimitMotor::
79set_high_limit(PN_stdfloat limit) {
80 LightMutexHolder holder(BulletWorld::get_global_lock());
81
82 _motor.m_hiLimit = (btScalar)limit;
83}
84
85/**
86 *
87 */
88void BulletRotationalLimitMotor::
89set_target_velocity(PN_stdfloat velocity) {
90 LightMutexHolder holder(BulletWorld::get_global_lock());
91
92 _motor.m_targetVelocity = (btScalar)velocity;
93}
94
95/**
96 *
97 */
98void BulletRotationalLimitMotor::
99set_max_motor_force(PN_stdfloat force) {
100 LightMutexHolder holder(BulletWorld::get_global_lock());
101
102 _motor.m_maxMotorForce = (btScalar)force;
103}
104
105/**
106 *
107 */
108void BulletRotationalLimitMotor::
109set_max_limit_force(PN_stdfloat force) {
110 LightMutexHolder holder(BulletWorld::get_global_lock());
111
112 _motor.m_maxLimitForce = (btScalar)force;
113}
114
115/**
116 *
117 */
118void BulletRotationalLimitMotor::
119set_damping(PN_stdfloat damping) {
120 LightMutexHolder holder(BulletWorld::get_global_lock());
121
122 _motor.m_damping = (btScalar)damping;
123}
124
125/**
126 *
127 */
128void BulletRotationalLimitMotor::
129set_softness(PN_stdfloat softness) {
130 LightMutexHolder holder(BulletWorld::get_global_lock());
131
132 _motor.m_limitSoftness = (btScalar)softness;
133}
134
135/**
136 *
137 */
138void BulletRotationalLimitMotor::
139set_bounce(PN_stdfloat bounce) {
140 LightMutexHolder holder(BulletWorld::get_global_lock());
141
142 _motor.m_bounce = (btScalar)bounce;
143}
144
145/**
146 *
147 */
148void BulletRotationalLimitMotor::
149set_normal_cfm(PN_stdfloat cfm) {
150 LightMutexHolder holder(BulletWorld::get_global_lock());
151
152 _motor.m_normalCFM = (btScalar)cfm;
153}
154
155/**
156 *
157 */
158void BulletRotationalLimitMotor::
159set_stop_cfm(PN_stdfloat cfm) {
160 LightMutexHolder holder(BulletWorld::get_global_lock());
161
162 _motor.m_stopCFM = (btScalar)cfm;
163}
164
165/**
166 *
167 */
168void BulletRotationalLimitMotor::
169set_stop_erp(PN_stdfloat erp) {
170 LightMutexHolder holder(BulletWorld::get_global_lock());
171
172 _motor.m_stopERP = (btScalar)erp;
173}
174
175/**
176 * Retrieves the current value of angle: 0 = free, 1 = at low limit, 2 = at
177 * high limit.
178 */
180get_current_limit() const {
181 LightMutexHolder holder(BulletWorld::get_global_lock());
182
183 return _motor.m_currentLimit;
184}
185
186/**
187 *
188 */
189PN_stdfloat BulletRotationalLimitMotor::
190get_current_error() const {
191 LightMutexHolder holder(BulletWorld::get_global_lock());
192
193 return (PN_stdfloat)_motor.m_currentLimitError;
194}
195
196/**
197 *
198 */
199PN_stdfloat BulletRotationalLimitMotor::
200get_current_position() const {
201 LightMutexHolder holder(BulletWorld::get_global_lock());
202
203 return (PN_stdfloat)_motor.m_currentPosition;
204}
205
206/**
207 *
208 */
209PN_stdfloat BulletRotationalLimitMotor::
210get_accumulated_impulse() const {
211 LightMutexHolder holder(BulletWorld::get_global_lock());
212
213 return (PN_stdfloat)_motor.m_accumulatedImpulse;
214}
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Rotation Limit structure for generic joints.
get_current_limit
Retrieves the current value of angle: 0 = free, 1 = at low limit, 2 = at high limit.
Similar to MutexHolder, but for a light mutex.