Panda3D
bulletBodyNode.I
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 bulletBodyNode.I
10  * @author enn0x
11  * @date 2010-11-19
12  */
13 
14 /**
15  *
16  */
17 INLINE BulletBodyNode::
18 ~BulletBodyNode() {
19 
20  if (_shape && (
21  _shape->getShapeType() == COMPOUND_SHAPE_PROXYTYPE ||
22  _shape->getShapeType() == EMPTY_SHAPE_PROXYTYPE)) {
23  delete _shape;
24  }
25 }
26 
27 /**
28  *
29  */
30 INLINE void BulletBodyNode::
31 set_into_collide_mask(CollideMask mask) {
32 
34 
35 /*
36  TODO: we would need a handle to the BulletWorld first
37  possible, but has to be set/cleared upon attach/remove to world
38 
39  if (!_world) return;
40 
41  btBroadphaseProxy* proxy = get_object()->getBroadphaseHandle();
42  if (proxy) {
43  btBroadphaseInterface *broadphase = _world->get_broadphase();
44  btDispatcher *dispatcher = _world->get_dispatcher();
45 
46  broadphase->getOverlappingPairCache()->cleanProxyFromPairs(proxy, dispatcher);
47  }
48 */
49 }
50 
51 /**
52  *
53  */
54 INLINE void BulletBodyNode::
55 notify_collisions(bool value) {
56 
57  set_collision_flag(btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK, value);
58 }
59 
60 /**
61  *
62  */
63 INLINE bool BulletBodyNode::
64 notifies_collisions() const {
65 
66  return get_collision_flag(btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
67 }
68 
69 /**
70  *
71  */
72 INLINE void BulletBodyNode::
73 set_collision_response(bool value) {
74 
75  set_collision_flag(btCollisionObject::CF_NO_CONTACT_RESPONSE, !value);
76 }
77 
78 /**
79  *
80  */
81 INLINE bool BulletBodyNode::
82 get_collision_response() const {
83 
84  return !get_collision_flag(btCollisionObject::CF_NO_CONTACT_RESPONSE);
85 }
86 
87 /**
88  *
89  */
90 INLINE void BulletBodyNode::
91 set_static(bool value) {
92 
93  set_collision_flag(btCollisionObject::CF_STATIC_OBJECT, value);
94 }
95 
96 /**
97  *
98  */
99 INLINE void BulletBodyNode::
100 set_kinematic(bool value) {
101 
102  set_collision_flag(btCollisionObject::CF_KINEMATIC_OBJECT, value);
103 }
104 
105 /**
106  * Enables or disables the debug visualisation for this collision object. By
107  * default the debug visualisation is enabled.
108  */
109 INLINE void BulletBodyNode::
110 set_debug_enabled(const bool enabled) {
111 
112  set_collision_flag(btCollisionObject::CF_DISABLE_VISUALIZE_OBJECT, !enabled);
113 }
114 
115 /**
116  * Returns TRUE if the debug visualisation is enabled for this collision
117  * object, and FALSE if the debug visualisation is disabled.
118  */
119 INLINE bool BulletBodyNode::
120 is_debug_enabled() const {
121 
122  return !get_collision_flag(btCollisionObject::CF_DISABLE_VISUALIZE_OBJECT);
123 }
set_debug_enabled
Enables or disables the debug visualisation for this collision object.
set_into_collide_mask
Sets the "into" CollideMask.
Definition: pandaNode.h:264
A general bitmask class.
Definition: bitMask.h:32