Skip to content

Commit 06d7646

Browse files
committed
DynamicsSystem.h:
* Added function remove_rigid_body() in DynamicsSystem that removes a rigid body by pointer.
1 parent db183c8 commit 06d7646

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Dynamics/DynamicsSystem.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ namespace dynamics
3939
return rb.get();
4040
}
4141

42+
void remove_rigid_body(RigidBody* rb)
43+
{
44+
stlutils::erase_if(m_rigid_bodies, [rb](const auto& rb_uptr) { return rb_uptr.get() == rb; });
45+
}
46+
4247
template<int NRB>
4348
std::array<RigidBody*, NRB> add_rigid_bodies(const std::array<Sprite*, NRB>& sprites,
4449
std::function<float(int)> rb_mass = [](int){ return 1.f; },

0 commit comments

Comments
 (0)