Physics3D/PhysWorld3D: Add ForEachBodyInAABB method
This commit is contained in:
@@ -36,6 +36,18 @@ namespace Nz
|
||||
return materialId;
|
||||
}
|
||||
|
||||
void PhysWorld3D::ForEachBodyInAABB(const Nz::Boxf& box, BodyIterator iterator)
|
||||
{
|
||||
auto NewtonCallback = [](const NewtonBody* const body, void* const userdata) -> int
|
||||
{
|
||||
BodyIterator& iterator = *static_cast<BodyIterator*>(userdata);
|
||||
RigidBody3D* nzBody = static_cast<RigidBody3D*>(NewtonBodyGetUserData(body));
|
||||
return iterator(*nzBody);
|
||||
};
|
||||
|
||||
NewtonWorldForEachBodyInAABBDo(m_world, box.GetMinimum(), box.GetMaximum(), NewtonCallback, &iterator);
|
||||
}
|
||||
|
||||
Vector3f PhysWorld3D::GetGravity() const
|
||||
{
|
||||
return m_gravity;
|
||||
|
||||
Reference in New Issue
Block a user