14 #ifndef __BULLET_WORLD_H__ 15 #define __BULLET_WORLD_H__ 57 void set_gravity(
const LVector3 &gravity);
58 void set_gravity(PN_stdfloat gx, PN_stdfloat gy, PN_stdfloat gz);
59 const LVector3 get_gravity()
const;
61 int do_physics(PN_stdfloat dt,
int max_substeps=1, PN_stdfloat stepsize=1.0f/60.0f);
67 void clear_debug_node();
69 INLINE
bool has_debug_node()
const;
74 void attach_constraint(
BulletConstraint *constraint,
bool linked_collision=
false);
77 int get_num_ghosts()
const;
79 MAKE_SEQ(get_ghosts, get_num_ghosts, get_ghost);
82 int get_num_rigid_bodies()
const;
84 MAKE_SEQ(get_rigid_bodies, get_num_rigid_bodies, get_rigid_body);
87 int get_num_soft_bodies()
const;
89 MAKE_SEQ(get_soft_bodies, get_num_soft_bodies, get_soft_body);
92 int get_num_characters()
const;
94 MAKE_SEQ(get_characters, get_num_characters, get_character);
96 int get_num_vehicles()
const;
98 MAKE_SEQ(get_vehicles, get_num_vehicles, get_vehicle);
101 int get_num_constraints()
const;
103 MAKE_SEQ(get_constraints, get_num_constraints, get_constraint);
107 const LPoint3 &from_pos,
108 const LPoint3 &to_pos,
112 const LPoint3 &from_pos,
113 const LPoint3 &to_pos,
121 PN_stdfloat penetration=0.0f)
const;
129 int get_num_manifolds()
const;
131 MAKE_SEQ(get_manifolds, get_num_manifolds, get_manifold);
134 void set_group_collision_flag(
unsigned int group1,
unsigned int group2,
bool enable);
135 bool get_group_collision_flag(
unsigned int group1,
unsigned int group2)
const;
137 void set_force_update_all_aabbs(
bool force);
138 bool get_force_update_all_aabbs()
const;
142 void clear_contact_added_callback();
144 void set_tick_callback(
CallbackObject *obj,
bool is_pretick=
false);
145 void clear_tick_callback();
148 void clear_filter_callback();
151 enum BroadphaseAlgorithm {
153 BA_dynamic_aabb_tree,
156 enum FilterAlgorithm {
162 MAKE_PROPERTY(gravity, get_gravity, set_gravity);
163 MAKE_PROPERTY(world_info, get_world_info);
164 MAKE_PROPERTY2(debug_node, has_debug_node, get_debug_node, set_debug_node, clear_debug_node);
165 MAKE_SEQ_PROPERTY(ghosts, get_num_ghosts, get_ghost);
166 MAKE_SEQ_PROPERTY(rigid_bodies, get_num_rigid_bodies, get_rigid_body);
167 MAKE_SEQ_PROPERTY(soft_bodies, get_num_soft_bodies, get_soft_body);
168 MAKE_SEQ_PROPERTY(characters, get_num_characters, get_character);
169 MAKE_SEQ_PROPERTY(vehicles, get_num_vehicles, get_vehicle);
170 MAKE_SEQ_PROPERTY(constraints, get_num_constraints, get_constraint);
171 MAKE_SEQ_PROPERTY(manifolds, get_num_manifolds, get_manifold);
172 MAKE_PROPERTY(force_update_all_aabbs, get_force_update_all_aabbs,
173 set_force_update_all_aabbs);
194 static btCollisionObject *get_collision_object(
PandaNode *node);
196 INLINE btDynamicsWorld *get_world()
const;
197 INLINE btBroadphaseInterface *get_broadphase()
const;
198 INLINE btDispatcher *get_dispatcher()
const;
203 void do_sync_p2b(PN_stdfloat dt,
int num_substeps);
221 void do_attach_constraint(
BulletConstraint *constraint,
bool linked_collision=
false);
224 static void tick_callback(btDynamicsWorld *world, btScalar timestep);
238 struct btFilterCallback1 :
public btOverlapFilterCallback {
239 virtual bool needBroadphaseCollision(
240 btBroadphaseProxy* proxy0,
241 btBroadphaseProxy* proxy1)
const;
244 struct btFilterCallback2 :
public btOverlapFilterCallback {
245 virtual bool needBroadphaseCollision(
246 btBroadphaseProxy* proxy0,
247 btBroadphaseProxy* proxy1)
const;
252 struct btFilterCallback3 :
public btOverlapFilterCallback {
253 virtual bool needBroadphaseCollision(
254 btBroadphaseProxy* proxy0,
255 btBroadphaseProxy* proxy1)
const;
260 btBroadphaseInterface *_broadphase;
261 btCollisionConfiguration *_configuration;
262 btCollisionDispatcher *_dispatcher;
263 btConstraintSolver *_solver;
264 btSoftRigidDynamicsWorld *_world;
266 btGhostPairCallback _ghost_cb;
268 FilterAlgorithm _filter_algorithm;
269 btFilterCallback1 _filter_cb1;
270 btFilterCallback2 _filter_cb2;
271 btFilterCallback3 _filter_cb3;
272 btOverlapFilterCallback *_filter_cb;
278 btSoftBodyWorldInfo _info;
280 BulletRigidBodies _bodies;
281 BulletSoftBodies _softbodies;
282 BulletGhosts _ghosts;
283 BulletCharacterControllers _characters;
284 BulletVehicles _vehicles;
285 BulletConstraints _constraints;
291 static void init_type() {
292 TypedReferenceCount::init_type();
294 TypedReferenceCount::get_class_type());
297 return get_class_type();
301 return get_class_type();
308 EXPCL_PANDABULLET std::ostream &
309 operator << (std::ostream &out, BulletWorld::BroadphaseAlgorithm algorithm);
310 EXPCL_PANDABULLET std::istream &
311 operator >> (std::istream &in, BulletWorld::BroadphaseAlgorithm &algorithm);
313 EXPCL_PANDABULLET std::ostream &
314 operator << (std::ostream &out, BulletWorld::FilterAlgorithm algorithm);
315 EXPCL_PANDABULLET std::istream &
316 operator >> (std::istream &in, BulletWorld::FilterAlgorithm &algorithm);
320 #endif // __BULLET_WORLD_H__ PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A basic node of the scene graph or data graph.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static BitMask< WType, nbits > all_on()
Returns a BitMask whose bits are all on.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
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.
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Simulates a raycast vehicle which casts a ray per wheel at the ground as a cheap replacement for comp...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A lightweight class that represents a single element that may be timed and/or counted via stats.
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.
This is a generic object that can be assigned to a callback at various points in the rendering proces...
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.
This is a standard, non-reentrant mutex, similar to the Mutex class.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.