Panda3D
Loading...
Searching...
No Matches
panda
src
ode
odeBody.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 odeBody.cxx
10
* @author joswilso
11
* @date 2006-12-27
12
*/
13
14
#include "
config_ode.h
"
15
#include "
odeBody.h
"
16
#include "
odeJoint.h
"
17
18
TypeHandle
OdeBody::_type_handle;
19
20
OdeBody::
21
OdeBody(dBodyID
id
) :
22
_id(id) {
23
}
24
25
OdeBody::
26
OdeBody(
OdeWorld
&world) :
27
_id(dBodyCreate(world.get_id())) {
28
world.add_body_dampening(*
this
, 0);
29
}
30
31
OdeBody::
32
~OdeBody() {
33
}
34
35
void
OdeBody::
36
destroy() {
37
if
(_destroy_callback !=
nullptr
) {
38
_destroy_callback(*
this
);
39
_destroy_callback =
nullptr
;
40
}
41
nassertv(_id);
42
dBodyDestroy(_id);
43
}
44
45
OdeJoint
OdeBody::
46
get_joint(
int
index)
const
{
47
nassertr(_id !=
nullptr
,
OdeJoint
(
nullptr
));
48
nassertr(index < get_num_joints(),
OdeJoint
(
nullptr
));
49
return
OdeJoint
(dBodyGetJoint(_id, index));
50
}
51
52
void
OdeBody::
53
write(std::ostream &out,
unsigned
int
indent
)
const
{
54
out.width(
indent
); out <<
""
<< get_type() \
55
<<
"(id = "
<< _id \
56
<<
")"
;
57
}
58
59
OdeBody::
60
operator bool ()
const
{
61
return
(_id !=
nullptr
);
62
}
OdeJoint
Definition
odeJoint.h:51
OdeWorld
Definition
odeWorld.h:33
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition
typeHandle.h:81
config_ode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
indent
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition
indent.cxx:20
odeBody.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
odeJoint.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Generated on Mon Jan 8 2024 17:18:41 for Panda3D by
1.10.0