mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Support different agent collision shape type for pathfinding
Actors may have different collision shapes. Currently there are axis-aligned bounding boxes and rotating bounding boxes. With AABB it's required to use bounding cylinder for navmesh agent to avoid providing paths where actor can't pass. But for rotating bounding boxes cylinder with diameter equal to the front face width should be used to not reduce of available paths. For example rats have rotating bounding box as collision shape because of the difference between front and side faces width. * Add agent bounds to navmesh tile db cache key. This is required to distinguish tiles for agents with different bounds. * Increase navmesh version because navmesh tile db cache key and data has changed. * Move navmesh version to the code to avoid misconfiguration by users. * Fix all places where wrong half extents were used for pathfinding.
This commit is contained in:
parent
15c7ed774c
commit
1a12c453d6
51 changed files with 515 additions and 389 deletions
|
@ -37,7 +37,7 @@ namespace
|
|||
namespace SceneUtil
|
||||
{
|
||||
osg::ref_ptr<osg::Group> createAgentPathGroup(const std::deque<osg::Vec3f>& path,
|
||||
const osg::Vec3f& halfExtents, const osg::Vec3f& start, const osg::Vec3f& end,
|
||||
const DetourNavigator::AgentBounds& agentBounds, const osg::Vec3f& start, const osg::Vec3f& end,
|
||||
const DetourNavigator::RecastSettings& settings)
|
||||
{
|
||||
using namespace DetourNavigator;
|
||||
|
@ -46,8 +46,8 @@ namespace SceneUtil
|
|||
|
||||
DebugDraw debugDraw(*group, DebugDraw::makeStateSet(), osg::Vec3f(0, 0, 0), 1);
|
||||
|
||||
const auto agentRadius = DetourNavigator::getAgentRadius(halfExtents);
|
||||
const auto agentHeight = DetourNavigator::getAgentHeight(halfExtents);
|
||||
const auto agentRadius = DetourNavigator::getAgentRadius(agentBounds);
|
||||
const auto agentHeight = DetourNavigator::getAgentHeight(agentBounds);
|
||||
const auto agentClimb = settings.mMaxClimb;
|
||||
const auto startColor = duRGBA(128, 25, 0, 192);
|
||||
const auto endColor = duRGBA(51, 102, 0, 129);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue