Browse Source

Add NavigationPushiness::NAVIGATIONPUSHINESS_NONE

1vanK 9 years ago
parent
commit
6323aed69a

+ 5 - 1
Source/ThirdParty/DetourCrowd/source/DetourCrowd.cpp

@@ -16,7 +16,7 @@
 // 3. This notice may not be removed or altered from any source distribution.
 // 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
 #define _USE_MATH_DEFINES
 #include <string.h>
 #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;
 					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);			
 				dtVmad(ag->disp, ag->disp, diff, pen);			
 				
 				
 				w += 1.0f;
 				w += 1.0f;

+ 1 - 0
Source/Urho3D/AngelScript/NavigationAPI.cpp

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

+ 2 - 1
Source/Urho3D/LuaScript/pkgs/Navigation/CrowdAgent.pkg

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

+ 5 - 0
Source/Urho3D/Navigation/CrowdAgent.cpp

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

+ 2 - 1
Source/Urho3D/Navigation/CrowdAgent.h

@@ -64,7 +64,8 @@ enum NavigationPushiness
 {
 {
     NAVIGATIONPUSHINESS_LOW = 0,
     NAVIGATIONPUSHINESS_LOW = 0,
     NAVIGATIONPUSHINESS_MEDIUM,
     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.
 /// 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.