1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-06 00:55:50 +00:00
OpenMW/components/detournavigator/recastparams.hpp
elsid fdd84265b3
Use proper agent height and radius when render actor path
That are based on half extents used to find path over navmesh which is different
for interior and exterior cells.

Use common functions to get agent height and radius for actor path rendering and
navmesh generation.
2022-06-15 01:11:11 +02:00

22 lines
482 B
C++

#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTPARAMS_H
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTPARAMS_H
#include <osg/Vec3f>
#include <cmath>
namespace DetourNavigator
{
inline float getAgentHeight(const osg::Vec3f& agentHalfExtents)
{
return 2.0f * agentHalfExtents.z();
}
inline float getAgentRadius(const osg::Vec3f& agentHalfExtents)
{
return std::max(agentHalfExtents.x(), agentHalfExtents.y()) * std::sqrt(2);
}
}
#endif