19 TypeHandle BulletGenericConstraint::_type_handle;
24 BulletGenericConstraint::
29 btRigidBody *ptr_a = btRigidBody::upcast(node_a->get_object());
30 btTransform trans_a = TransformState_to_btTrans(frame_a);
32 _constraint =
new btGeneric6DofConstraint(*ptr_a, trans_a, use_frame_a);
38 BulletGenericConstraint::
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 btGeneric6DofConstraint(*ptr_a, *ptr_b, trans_a, trans_b, use_frame_a);
57 btTypedConstraint *BulletGenericConstraint::
66 LVector3 BulletGenericConstraint::
67 get_axis(
int axis)
const {
70 nassertr(axis >= 0, LVector3::zero());
71 nassertr(axis <= 3, LVector3::zero());
73 _constraint->buildJacobian();
74 return btVector3_to_LVector3(_constraint->getAxis(axis));
80 PN_stdfloat BulletGenericConstraint::
81 get_pivot(
int axis)
const {
84 nassertr(axis >= 0, 0.0f);
85 nassertr(axis <= 3, 0.0f);
87 _constraint->buildJacobian();
88 return _constraint->getRelativePivotPosition(axis);
94 PN_stdfloat BulletGenericConstraint::
95 get_angle(
int axis)
const {
98 nassertr(axis >= 0, 0.0f);
99 nassertr(axis <= 3, 0.0f);
101 _constraint->buildJacobian();
102 return _constraint->getAngle(axis);
108 void BulletGenericConstraint::
109 set_linear_limit(
int axis, PN_stdfloat low, PN_stdfloat high) {
115 _constraint->buildJacobian();
116 _constraint->setLimit(axis, low, high);
122 void BulletGenericConstraint::
123 set_angular_limit(
int axis, PN_stdfloat low, PN_stdfloat high) {
129 low = deg_2_rad(low);
130 high = deg_2_rad(high);
132 _constraint->buildJacobian();
133 _constraint->setLimit(axis + 3, low, high);
140 get_frame_a()
const {
143 return btTrans_to_TransformState(_constraint->getFrameOffsetA());
150 get_frame_b()
const {
153 return btTrans_to_TransformState(_constraint->getFrameOffsetB());
160 get_rotational_limit_motor(
int axis) {
170 get_translational_limit_motor() {
179 void BulletGenericConstraint::
183 btTransform frame_a = TransformState_to_btTrans(ts_a);
184 btTransform frame_b = TransformState_to_btTrans(ts_b);
186 _constraint->setFrames(frame_a, frame_b);
Rotation Limit structure for generic joints.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Rotation Limit structure for generic joints.
Similar to MutexHolder, but for a light mutex.
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.