34 if (odejoint_cat.is_debug()) {
35 std::ostream &out = odejoint_cat.debug();
36 out << get_type() <<
"(" << _id <<
")\n";
41OdeJoint(dJointID
id) :
43 if (odejoint_cat.is_debug()) {
44 std::ostream &out = odejoint_cat.debug();
45 out << get_type() <<
"(" << _id <<
")\n";
67 nassertv(body1.
get_id() !=
nullptr || body2.
get_id() !=
nullptr);
79 nassertv(body.
get_id() !=
nullptr);
80 nassertv(index == 0 || index == 1);
82 dJointAttach(_id, body.
get_id(),
nullptr);
84 dJointAttach(_id,
nullptr, body.
get_id());
91 dJointAttach(_id,
nullptr,
nullptr);
95get_body(
int index)
const {
96 nassertr(_id, OdeBody(
nullptr));
97 nassertr(index == 0 || index == 1, OdeBody(
nullptr));
98 return OdeBody(dJointGetBody(_id, index));
102write(std::ostream &out,
unsigned int indent)
const {
103 out.width(
indent); out <<
"" << get_type() \
106 OdeBody body = get_body(0);
107 if (body.
get_id() !=
nullptr) {
115 if (body.
get_id() !=
nullptr) {
126operator bool ()
const {
127 return (_id !=
nullptr);
131convert_to_ball()
const {
132 nassertr(_id !=
nullptr, OdeBallJoint(
nullptr));
133 nassertr(get_joint_type() == JT_ball, OdeBallJoint(
nullptr));
134 return OdeBallJoint(_id);
138convert_to_hinge()
const {
139 nassertr(_id !=
nullptr, OdeHingeJoint(
nullptr));
140 nassertr(get_joint_type() == JT_hinge, OdeHingeJoint(
nullptr));
141 return OdeHingeJoint(_id);
145convert_to_slider()
const {
146 nassertr(_id !=
nullptr, OdeSliderJoint(
nullptr));
147 nassertr(get_joint_type() == JT_slider, OdeSliderJoint(
nullptr));
148 return OdeSliderJoint(_id);
152convert_to_contact()
const {
153 nassertr(_id !=
nullptr, OdeContactJoint(
nullptr));
154 nassertr(get_joint_type() == JT_contact, OdeContactJoint(
nullptr));
155 return OdeContactJoint(_id);
159convert_to_universal()
const {
160 nassertr(_id !=
nullptr, OdeUniversalJoint(
nullptr));
161 nassertr(get_joint_type() == JT_universal, OdeUniversalJoint(
nullptr));
162 return OdeUniversalJoint(_id);
166convert_to_hinge2()
const {
167 nassertr(_id !=
nullptr, OdeHinge2Joint(
nullptr));
168 nassertr(get_joint_type() == JT_hinge2, OdeHinge2Joint(
nullptr));
169 return OdeHinge2Joint(_id);
173convert_to_fixed()
const {
174 nassertr(_id !=
nullptr, OdeFixedJoint(
nullptr));
175 nassertr(get_joint_type() == JT_fixed, OdeFixedJoint(
nullptr));
176 return OdeFixedJoint(_id);
180convert_to_null()
const {
181 nassertr(_id !=
nullptr, OdeNullJoint(
nullptr));
182 nassertr(get_joint_type() == JT_null, OdeNullJoint(
nullptr));
183 return OdeNullJoint(_id);
187convert_to_a_motor()
const {
188 nassertr(_id !=
nullptr, OdeAMotorJoint(
nullptr));
189 nassertr(get_joint_type() == JT_a_motor, OdeAMotorJoint(
nullptr));
190 return OdeAMotorJoint(_id);
194convert_to_l_motor()
const {
195 nassertr(_id !=
nullptr, OdeLMotorJoint(
nullptr));
196 nassertr(get_joint_type() == JT_l_motor, OdeLMotorJoint(
nullptr));
197 return OdeLMotorJoint(_id);
201convert_to_plane2d()
const {
202 nassertr(_id !=
nullptr, OdePlane2dJoint(
nullptr));
203 nassertr(get_joint_type() == JT_plane2d, OdePlane2dJoint(
nullptr));
204 return OdePlane2dJoint(_id);
dBodyID get_id() const
Returns the underlying dBodyID.
void attach_body(const OdeBody &body, int index)
Attaches a single OdeBody to this joint at the specified index (0 or 1).
void attach_bodies(const OdeBody &body1, const OdeBody &body2)
Attaches two OdeBody objects to this joint.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.