mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-01 12:01:51 +00:00
506824cb9d
* Do not copy with allocations. * Remove unused DeepestNotMeContactTestResultCallback. * Avoid using pointers which should not be nullptr. * Move constructors implementation to headers. * Move types defined in .cpp are to unnamed namespace. * Comment unused arguments. * Avoid C-style casts.
27 lines
817 B
C++
27 lines
817 B
C++
#include "closestnotmerayresultcallback.hpp"
|
|
|
|
#include <algorithm>
|
|
|
|
#include <BulletCollision/CollisionDispatch/btCollisionObject.h>
|
|
|
|
#include "collisiontype.hpp"
|
|
|
|
namespace MWPhysics
|
|
{
|
|
btScalar ClosestNotMeRayResultCallback::addSingleResult(
|
|
btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace)
|
|
{
|
|
const auto* hitObject = rayResult.m_collisionObject;
|
|
if (hitObject == mMe)
|
|
return 1.f;
|
|
|
|
if (hitObject->getBroadphaseHandle()->m_collisionFilterGroup == CollisionType_Actor && !mTargets.empty())
|
|
{
|
|
if ((std::find(mTargets.begin(), mTargets.end(), hitObject) == mTargets.end()))
|
|
return 1.f;
|
|
}
|
|
|
|
return btCollisionWorld::ClosestRayResultCallback::addSingleResult(rayResult, normalInWorldSpace);
|
|
}
|
|
}
|