34 if (odejoint_cat.is_debug()) {
35 std::ostream &out = odejoint_cat.debug();
36 out << get_type() <<
"(" << _id <<
")\n";
41 OdeJoint(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);
95 get_body(
int index)
const {
96 nassertr(_id,
OdeBody(
nullptr));
97 nassertr(index == 0 || index == 1,
OdeBody(
nullptr));
98 return OdeBody(dJointGetBody(_id, index));
102 write(std::ostream &out,
unsigned int indent)
const {
103 out.width(
indent); out <<
"" << get_type() \
107 if (body.
get_id() !=
nullptr) {
115 if (body.
get_id() !=
nullptr) {
126 operator bool ()
const {
127 return (_id !=
nullptr);
131 convert_to_ball()
const {
133 nassertr(get_joint_type() == JT_ball,
OdeBallJoint(
nullptr));
138 convert_to_hinge()
const {
140 nassertr(get_joint_type() == JT_hinge,
OdeHingeJoint(
nullptr));
145 convert_to_slider()
const {
152 convert_to_contact()
const {
159 convert_to_universal()
const {
166 convert_to_hinge2()
const {
173 convert_to_fixed()
const {
175 nassertr(get_joint_type() == JT_fixed,
OdeFixedJoint(
nullptr));
180 convert_to_null()
const {
182 nassertr(get_joint_type() == JT_null,
OdeNullJoint(
nullptr));
187 convert_to_a_motor()
const {
189 nassertr(get_joint_type() == JT_a_motor,
OdeAMotorJoint(
nullptr));
194 convert_to_l_motor()
const {
196 nassertr(get_joint_type() == JT_l_motor,
OdeLMotorJoint(
nullptr));
201 convert_to_plane2d()
const {
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.