21TypeHandle BulletConeTwistConstraint::_type_handle;
26BulletConeTwistConstraint::
30 btRigidBody *ptr_a = btRigidBody::upcast(node_a->get_object());
31 btTransform trans_a = TransformState_to_btTrans(frame_a);
33 _constraint =
new btConeTwistConstraint(*ptr_a, trans_a);
39BulletConeTwistConstraint::
45 btRigidBody *ptr_a = btRigidBody::upcast(node_a->get_object());
46 btTransform trans_a = TransformState_to_btTrans(frame_a);
48 btRigidBody *ptr_b = btRigidBody::upcast(node_b->get_object());
49 btTransform trans_b = TransformState_to_btTrans(frame_b);
51 _constraint =
new btConeTwistConstraint(*ptr_a, *ptr_b, trans_a, trans_b);
57btTypedConstraint *BulletConeTwistConstraint::
66void BulletConeTwistConstraint::
67set_limit(
int index, PN_stdfloat value) {
68 LightMutexHolder holder(BulletWorld::get_global_lock());
70 value = deg_2_rad(value);
72 _constraint->setLimit(index, value);
78void BulletConeTwistConstraint::
79set_limit(PN_stdfloat swing1, PN_stdfloat swing2, PN_stdfloat twist, PN_stdfloat softness, PN_stdfloat bias, PN_stdfloat relaxation) {
80 LightMutexHolder holder(BulletWorld::get_global_lock());
82 swing1 = deg_2_rad(swing1);
83 swing2 = deg_2_rad(swing2);
84 twist = deg_2_rad(twist);
86 _constraint->setLimit(swing1, swing2, twist, softness, bias, relaxation);
92void BulletConeTwistConstraint::
93set_damping(PN_stdfloat damping) {
94 LightMutexHolder holder(BulletWorld::get_global_lock());
96 _constraint->setDamping(damping);
102PN_stdfloat BulletConeTwistConstraint::
103get_fix_threshold()
const {
104 LightMutexHolder holder(BulletWorld::get_global_lock());
106 return _constraint->getFixThresh();
112void BulletConeTwistConstraint::
113set_fix_threshold(PN_stdfloat threshold) {
114 LightMutexHolder holder(BulletWorld::get_global_lock());
116 _constraint->setFixThresh(threshold);
122void BulletConeTwistConstraint::
123enable_motor(
bool enable) {
124 LightMutexHolder holder(BulletWorld::get_global_lock());
126 _constraint->enableMotor(enable);
132void BulletConeTwistConstraint::
133set_max_motor_impulse(PN_stdfloat max_impulse) {
134 LightMutexHolder holder(BulletWorld::get_global_lock());
136 _constraint->setMaxMotorImpulse(max_impulse);
142void BulletConeTwistConstraint::
143set_max_motor_impulse_normalized(PN_stdfloat max_impulse) {
144 LightMutexHolder holder(BulletWorld::get_global_lock());
146 _constraint->setMaxMotorImpulseNormalized(max_impulse);
152void BulletConeTwistConstraint::
153set_motor_target(
const LQuaternion &quat) {
154 LightMutexHolder holder(BulletWorld::get_global_lock());
156 _constraint->setMotorTarget(LQuaternion_to_btQuat(quat));
162void BulletConeTwistConstraint::
163set_motor_target_in_constraint_space(
const LQuaternion &quat) {
164 LightMutexHolder holder(BulletWorld::get_global_lock());
166 _constraint->setMotorTargetInConstraintSpace(LQuaternion_to_btQuat(quat));
172void BulletConeTwistConstraint::
174 LightMutexHolder holder(BulletWorld::get_global_lock());
176 btTransform frame_a = TransformState_to_btTrans(ts_a);
177 btTransform frame_b = TransformState_to_btTrans(ts_b);
179 _constraint->setFrames(frame_a, frame_b);
187 LightMutexHolder holder(BulletWorld::get_global_lock());
189 return btTrans_to_TransformState(_constraint->getAFrame());
197 LightMutexHolder holder(BulletWorld::get_global_lock());
199 return btTrans_to_TransformState(_constraint->getBFrame());
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.