Add NavigationPushiness::NAVIGATIONPUSHINESS_NONE

This commit is contained in:
1vanK 2016-09-11 14:37:54 +03:00
parent 61f8fb5205
commit 6323aed69a
5 changed files with 15 additions and 3 deletions

View File

@ -16,7 +16,7 @@
// 3. This notice may not be removed or altered from any source distribution.
//
// Modified by Lasse Oorni, Yao Wei Tjong and cosmy1 for Urho3D
// Modified by Lasse Oorni, Yao Wei Tjong, 1vanK and cosmy1 for Urho3D
#define _USE_MATH_DEFINES
#include <string.h>
@ -1376,6 +1376,10 @@ void dtCrowd::update(const float dt, dtCrowdAgentDebugInfo* debug)
pen = (1.0f/dist) * (pen*0.5f) * COLLISION_RESOLVE_FACTOR;
}
// Urho3D: Avoid tremble when another agent can not move away
if (ag->params.separationWeight < 0.0001f)
continue;
dtVmad(ag->disp, ag->disp, diff, pen);
w += 1.0f;

View File

@ -291,6 +291,7 @@ void RegisterCrowdAgent(asIScriptEngine* engine)
engine->RegisterEnumValue("NavigationPushiness", "NAVIGATIONPUSHINESS_LOW", NAVIGATIONPUSHINESS_LOW);
engine->RegisterEnumValue("NavigationPushiness", "NAVIGATIONPUSHINESS_MEDIUM", NAVIGATIONPUSHINESS_MEDIUM);
engine->RegisterEnumValue("NavigationPushiness", "NAVIGATIONPUSHINESS_HIGH", NAVIGATIONPUSHINESS_HIGH);
engine->RegisterEnumValue("NavigationPushiness", "NAVIGATIONPUSHINESS_NONE", NAVIGATIONPUSHINESS_NONE);
RegisterComponent<CrowdAgent>(engine, "CrowdAgent");
engine->RegisterObjectMethod("CrowdAgent", "void DrawDebugGeometry(bool)", asMETHODPR(CrowdAgent, DrawDebugGeometry, (bool), void), asCALL_THISCALL);

View File

@ -36,7 +36,8 @@ enum NavigationPushiness
{
NAVIGATIONPUSHINESS_LOW = 0,
NAVIGATIONPUSHINESS_MEDIUM,
NAVIGATIONPUSHINESS_HIGH
NAVIGATIONPUSHINESS_HIGH,
NAVIGATIONPUSHINESS_NONE
};
class CrowdAgent : public Component

View File

@ -241,6 +241,11 @@ void CrowdAgent::UpdateParameters(unsigned scope)
params.separationWeight = 0.5f;
params.collisionQueryRange = radius_ * 1.0f;
break;
case NAVIGATIONPUSHINESS_NONE:
params.separationWeight = 0.0f;
params.collisionQueryRange = radius_ * 1.0f;
break;
}
}

View File

@ -64,7 +64,8 @@ enum NavigationPushiness
{
NAVIGATIONPUSHINESS_LOW = 0,
NAVIGATIONPUSHINESS_MEDIUM,
NAVIGATIONPUSHINESS_HIGH
NAVIGATIONPUSHINESS_HIGH,
NAVIGATIONPUSHINESS_NONE
};
/// Crowd agent component, requires a CrowdManager component in the scene. When not set explicitly, agent's radius and height are defaulted to navigation mesh's agent radius and height, respectively.