From 3157c1e7642663bbeb6eb8d2a40cdd5a1181daff Mon Sep 17 00:00:00 2001 From: wrenge Date: Mon, 22 Apr 2024 15:31:22 +0300 Subject: [PATCH] Avoidance patches --- src/DotRecast.Detour.Crowd/DtCrowd.cs | 3 +++ src/DotRecast.Detour.Crowd/DtCrowdAgentParams.cs | 3 +++ src/package.json | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/DotRecast.Detour.Crowd/DtCrowd.cs b/src/DotRecast.Detour.Crowd/DtCrowd.cs index 892c4b3..4bbc440 100644 --- a/src/DotRecast.Detour.Crowd/DtCrowd.cs +++ b/src/DotRecast.Detour.Crowd/DtCrowd.cs @@ -1141,6 +1141,9 @@ namespace DotRecast.Detour.Crowd for (int j = 0; j < ag.neis.Count; ++j) { DtCrowdAgent nei = ag.neis[j].agent; + if(!nei.option.contributeObstacleAvoidance || nei.option.obstacleAvoidanceWeight < ag.option.obstacleAvoidanceWeight) + continue; + _obstacleQuery.AddCircle(nei.npos, nei.option.radius, nei.vel, nei.dvel); } diff --git a/src/DotRecast.Detour.Crowd/DtCrowdAgentParams.cs b/src/DotRecast.Detour.Crowd/DtCrowdAgentParams.cs index ca78784..2c18ca0 100644 --- a/src/DotRecast.Detour.Crowd/DtCrowdAgentParams.cs +++ b/src/DotRecast.Detour.Crowd/DtCrowdAgentParams.cs @@ -53,6 +53,9 @@ namespace DotRecast.Detour.Crowd /// [Limits: 0 <= value < #DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS] public int obstacleAvoidanceType; + public bool contributeObstacleAvoidance; + public float obstacleAvoidanceWeight; + /// The index of the query filter used by this agent. public int queryFilterType; diff --git a/src/package.json b/src/package.json index c521e17..bcb0950 100644 --- a/src/package.json +++ b/src/package.json @@ -1,5 +1,5 @@ { "name": "com.rnd.dotrecast", "displayName": "DotRecast", - "version": "0.1.4-exp.1" + "version": "0.2.0" } \ No newline at end of file