diff --git a/panda/src/physics/physicsManager.I b/panda/src/physics/physicsManager.I index 67f85a3830..838404b1fb 100644 --- a/panda/src/physics/physicsManager.I +++ b/panda/src/physics/physicsManager.I @@ -51,10 +51,20 @@ add_linear_force(LinearForce *f) { //////////////////////////////////////////////////////////////////// // Function : attach_physicalnode // Access : Public -// Description : Registers an physicalnode with the manager +// Description : Registers a physicalnode with the manager //////////////////////////////////////////////////////////////////// INLINE void PhysicsManager:: attach_physicalnode(PhysicalNode *p) { + attach_physical_node(p); +} + +//////////////////////////////////////////////////////////////////// +// Function : attach_physical_node +// Access : Public +// Description : Registers a physicalnode with the manager +//////////////////////////////////////////////////////////////////// +INLINE void PhysicsManager:: +attach_physical_node(PhysicalNode *p) { nassertv(p); for (int i = 0; i < p->get_num_physicals(); i++) { attach_physical(p->get_physical(i)); diff --git a/panda/src/physics/physicsManager.cxx b/panda/src/physics/physicsManager.cxx index bc4dcb22a9..12d74793d8 100644 --- a/panda/src/physics/physicsManager.cxx +++ b/panda/src/physics/physicsManager.cxx @@ -100,6 +100,19 @@ remove_physical(Physical *p) { _physicals.erase(found); } +//////////////////////////////////////////////////////////////////// +// Function : remove_physical_node +// Access : Public +// Description : Removes a physicalnode from the manager +//////////////////////////////////////////////////////////////////// +void PhysicsManager:: +remove_physical_node(PhysicalNode *p) { + nassertv(p); + for (int i = 0; i < p->get_num_physicals(); i++) { + remove_physical(p->get_physical(i)); + } +} + //////////////////////////////////////////////////////////////////// // Function : DoPhysics // Access : Public diff --git a/panda/src/physics/physicsManager.h b/panda/src/physics/physicsManager.h index 51f9c0cee7..c4ae7ca334 100644 --- a/panda/src/physics/physicsManager.h +++ b/panda/src/physics/physicsManager.h @@ -59,6 +59,7 @@ PUBLISHED: INLINE void attach_angular_integrator(AngularIntegrator *i); INLINE void attach_physical(Physical *p); INLINE void attach_physicalnode(PhysicalNode *p); + INLINE void attach_physical_node(PhysicalNode *p); INLINE void add_linear_force(LinearForce *f); INLINE void add_angular_force(AngularForce *f); INLINE void clear_linear_forces(); @@ -69,6 +70,7 @@ PUBLISHED: INLINE float get_viscosity() const; void remove_physical(Physical *p); + void remove_physical_node(PhysicalNode *p); void remove_linear_force(LinearForce *f); void remove_angular_force(AngularForce *f); void do_physics(float dt);