14#ifndef __BULLET_WORLD_H__
15#define __BULLET_WORLD_H__
46extern EXPCL_PANDABULLET PT(
CallbackObject) bullet_contact_added_callback;
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;
132 MAKE_SEQ(get_manifolds, get_num_manifolds, __get_manifold);
135 void set_group_collision_flag(
unsigned int group1,
unsigned int group2,
bool enable);
136 bool get_group_collision_flag(
unsigned int group1,
unsigned int group2)
const;
138 void set_force_update_all_aabbs(
bool force);
139 bool get_force_update_all_aabbs()
const;
143 void clear_contact_added_callback();
145 void set_tick_callback(
CallbackObject *obj,
bool is_pretick=
false);
146 void clear_tick_callback();
149 void clear_filter_callback();
152 enum BroadphaseAlgorithm {
154 BA_dynamic_aabb_tree,
157 enum FilterAlgorithm {
163 MAKE_PROPERTY(gravity, get_gravity, set_gravity);
164 MAKE_PROPERTY(world_info, get_world_info);
165 MAKE_PROPERTY2(debug_node, has_debug_node, get_debug_node, set_debug_node, clear_debug_node);
166 MAKE_SEQ_PROPERTY(ghosts, get_num_ghosts, get_ghost);
167 MAKE_SEQ_PROPERTY(rigid_bodies, get_num_rigid_bodies, get_rigid_body);
168 MAKE_SEQ_PROPERTY(soft_bodies, get_num_soft_bodies, get_soft_body);
169 MAKE_SEQ_PROPERTY(characters, get_num_characters, get_character);
170 MAKE_SEQ_PROPERTY(vehicles, get_num_vehicles, get_vehicle);
171 MAKE_SEQ_PROPERTY(constraints, get_num_constraints, get_constraint);
172 MAKE_SEQ_PROPERTY(manifolds, get_num_manifolds, __get_manifold);
173 MAKE_PROPERTY(force_update_all_aabbs, get_force_update_all_aabbs,
174 set_force_update_all_aabbs);
195 static btCollisionObject *get_collision_object(
PandaNode *node);
197 INLINE btDynamicsWorld *get_world()
const;
198 INLINE btBroadphaseInterface *get_broadphase()
const;
199 INLINE btDispatcher *get_dispatcher()
const;
204 void do_sync_p2b(PN_stdfloat dt,
int num_substeps);
222 void do_attach_constraint(
BulletConstraint *constraint,
bool linked_collision=
false);
225 static void tick_callback(btDynamicsWorld *world, btScalar timestep);
239 struct btFilterCallback1 :
public btOverlapFilterCallback {
240 virtual bool needBroadphaseCollision(
241 btBroadphaseProxy* proxy0,
242 btBroadphaseProxy* proxy1)
const;
245 struct btFilterCallback2 :
public btOverlapFilterCallback {
246 virtual bool needBroadphaseCollision(
247 btBroadphaseProxy* proxy0,
248 btBroadphaseProxy* proxy1)
const;
253 struct btFilterCallback3 :
public btOverlapFilterCallback {
254 virtual bool needBroadphaseCollision(
255 btBroadphaseProxy* proxy0,
256 btBroadphaseProxy* proxy1)
const;
261 btBroadphaseInterface *_broadphase;
262 btCollisionConfiguration *_configuration;
263 btCollisionDispatcher *_dispatcher;
264 btConstraintSolver *_solver;
265 btSoftRigidDynamicsWorld *_world;
267 btGhostPairCallback _ghost_cb;
269 FilterAlgorithm _filter_algorithm;
270 btFilterCallback1 _filter_cb1;
271 btFilterCallback2 _filter_cb2;
272 btFilterCallback3 _filter_cb3;
273 btOverlapFilterCallback *_filter_cb;
279 btSoftBodyWorldInfo _info;
281 BulletRigidBodies _bodies;
282 BulletSoftBodies _softbodies;
283 BulletGhosts _ghosts;
284 BulletCharacterControllers _characters;
285 BulletVehicles _vehicles;
286 BulletConstraints _constraints;
292 static void init_type() {
293 TypedReferenceCount::init_type();
295 TypedReferenceCount::get_class_type());
298 return get_class_type();
302 return get_class_type();
309EXPCL_PANDABULLET std::ostream &
310operator << (std::ostream &out, BulletWorld::BroadphaseAlgorithm algorithm);
311EXPCL_PANDABULLET std::istream &
312operator >> (std::istream &in, BulletWorld::BroadphaseAlgorithm &algorithm);
314EXPCL_PANDABULLET std::ostream &
315operator << (std::ostream &out, BulletWorld::FilterAlgorithm algorithm);
316EXPCL_PANDABULLET std::istream &
317operator >> (std::istream &in, BulletWorld::FilterAlgorithm &algorithm);
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static BitMask< uint32_t, nbits > all_on()
Returns a BitMask whose bits are all on.
Simulates a raycast vehicle which casts a ray per wheel at the ground as a cheap replacement for comp...
This is a generic object that can be assigned to a callback at various points in the rendering proces...
This is a standard, non-reentrant mutex, similar to the Mutex class.
A lightweight class that represents a single element that may be timed and/or counted via stats.
A basic node of the scene graph or data graph.
TypeHandle is the identifier used to differentiate C++ class types.
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
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.
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.