diff --git a/panda/src/physics/forceNode.cxx b/panda/src/physics/forceNode.cxx index ae155b2c8f..fde40b6ee0 100644 --- a/panda/src/physics/forceNode.cxx +++ b/panda/src/physics/forceNode.cxx @@ -75,6 +75,21 @@ add_forces_from(const ForceNode &other) { (*last)->_force_node = this; } +//////////////////////////////////////////////////////////////////// +// Function : remove_force +// Access : public +// Description : remove operation +//////////////////////////////////////////////////////////////////// +void ForceNode:: +remove_force(BaseForce *f) { + vector< PT(BaseForce) >::iterator found; + PT(BaseForce) ptbf = f; + found = find(_forces.begin(), _forces.end(), ptbf); + if (found == _forces.end()) + return; + _forces.erase(found); +} + //////////////////////////////////////////////////////////////////// // Function : remove_force // Access : public diff --git a/panda/src/physics/forceNode.h b/panda/src/physics/forceNode.h index f7e128e2d9..e9ba07ad26 100644 --- a/panda/src/physics/forceNode.h +++ b/panda/src/physics/forceNode.h @@ -38,6 +38,7 @@ PUBLISHED: INLINE void add_force(BaseForce *force); void add_forces_from(const ForceNode &other); + void remove_force(BaseForce *f); void remove_force(int index); public: