Advertisement
Guest User

Untitled

a guest
Mar 21st, 2022
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.54 KB | None | 0 0
  1. From f0f02ebab425320d90e9920af69250d67d3e733f Mon Sep 17 00:00:00 2001
  2. From: Aron Granberg <aron.granberg@gmail.com>
  3. Date: Wed, 23 Feb 2022 11:33:47 +0100
  4. Subject: [PATCH 1/9] Fixed RVOController.velocity not working.
  5.  
  6. ---
  7. Assets/AstarPathfindingProject/Core/RVO/RVOAgentBurst.cs    | 6 ++++--
  8.  .../Core/RVO/RVOCoreSimulatorBurst.cs                       | 5 ++---
  9.  Assets/AstarPathfindingProject/changelog.cs                 | 2 +-
  10.  3 files changed, 7 insertions(+), 6 deletions(-)
  11.  
  12. diff --git a/Assets/AstarPathfindingProject/Core/RVO/RVOAgentBurst.cs b/Assets/AstarPathfindingProject/Core/RVO/RVOAgentBurst.cs
  13. index b84ac93b..a025557e 100644
  14. --- a/Assets/AstarPathfindingProject/Core/RVO/RVOAgentBurst.cs
  15. +++ b/Assets/AstarPathfindingProject/Core/RVO/RVOAgentBurst.cs
  16. @@ -502,7 +502,8 @@ namespace Pathfinding.RVO.Sampled {
  17.  
  18.             for (int agentIndex = startIndex; agentIndex < endIndex; agentIndex++) {
  19.                 if (agentData.manuallyControlled[agentIndex]) {
  20. -                   // TODO
  21. +                   output.speed[agentIndex] = agentData.desiredSpeed[agentIndex];
  22. +                   output.targetPoint[agentIndex] = agentData.targetPoint[agentIndex];
  23.                     continue;
  24.                 }
  25.  
  26. @@ -565,7 +566,8 @@ namespace Pathfinding.RVO.Sampled {
  27.  
  28.             for (int agentIndex = startIndex; agentIndex < endIndex; agentIndex++) {
  29.                 if (agentData.manuallyControlled[agentIndex]) {
  30. -                   // TODO
  31. +                   output.speed[agentIndex] = agentData.desiredSpeed[agentIndex];
  32. +                   output.targetPoint[agentIndex] = agentData.targetPoint[agentIndex];
  33.                     continue;
  34.                 }
  35.  
  36. diff --git a/Assets/AstarPathfindingProject/Core/RVO/RVOCoreSimulatorBurst.cs b/Assets/AstarPathfindingProject/Core/RVO/RVOCoreSimulatorBurst.cs
  37. index d8c1df20..96368129 100644
  38. --- a/Assets/AstarPathfindingProject/Core/RVO/RVOCoreSimulatorBurst.cs
  39. +++ b/Assets/AstarPathfindingProject/Core/RVO/RVOCoreSimulatorBurst.cs
  40. @@ -441,10 +441,8 @@ namespace Pathfinding.RVO {
  41.             public void ForceSetVelocity (Vector3 velocity) {
  42.                 // A bit hacky, but it is approximately correct
  43.                 // assuming the agent does not move significantly
  44. -               // TODO: non-burst also sets simulator.outputData.targetPoint
  45.                 simulator.simulationData.targetPoint[agentIndex] = simulator.simulationData.position[agentIndex] + (float3)velocity * 1000;
  46.                 simulator.simulationData.desiredSpeed[agentIndex] = velocity.magnitude;
  47. -               // TODO: non-burst also sets CalculatedSpeed
  48.                 simulator.simulationData.manuallyControlled[agentIndex] = true;
  49.             }
  50.         }
  51. @@ -973,6 +971,7 @@ namespace Pathfinding.RVO {
  52.                 // The normal is reset every simulation tick
  53.                 // Note that the copied data still contains the real normal.
  54.                 var clearJob = simulationData.collisionNormal.MemSet(float3.zero).Schedule(JobHandle.CombineDependencies(copyJob, preprocessJob));
  55. +               var clearJob2 = simulationData.manuallyControlled.MemSet(false).Schedule(JobHandle.CombineDependencies(copyJob, preprocessJob));
  56.  
  57.                 int batchSize = math.max(numAgents / 32, 4);
  58.                 var neighboursJob = new JobRVOCalculateNeighbours<T> {
  59. @@ -1027,7 +1026,7 @@ namespace Pathfinding.RVO {
  60.                 var rvoJob = rvoJobData.ScheduleBatch(numAgents, batchSize, combinedJob);
  61.  
  62.                 JobHandle.ScheduleBatchedJobs();
  63. -               JobHandle.CombineDependencies(combinedJob, clearJob).Complete();
  64. +               JobHandle.CombineDependencies(combinedJob, clearJob, clearJob2).Complete();
  65.  
  66.                 if (DoubleBuffering && !anyDebugEnabled[0]) {
  67.                     inProgressJob = rvoJob;
  68. diff --git a/Assets/AstarPathfindingProject/changelog.cs b/Assets/AstarPathfindingProject/changelog.cs
  69. index 56104a04..c8cae138 100644
  70. --- a/Assets/AstarPathfindingProject/changelog.cs
  71. +++ b/Assets/AstarPathfindingProject/changelog.cs
  72. @@ -8,7 +8,7 @@
  73.     - Fixed some smaller memory memory leaks in the unity editor.
  74.     - Fixed some warnings related to ENABLE_UNITY_COLLECTIONS_CHECKS which burst would log when building a standalone player.
  75.     - Fixed AIPathAlignedToSurface would throw an exception if no RVOController was attached.
  76. -   - Fixed setting \reflink{RVOController.velocity} would be buggy except in 2D space (regression from 4.3.x).
  77. +   - Fixed setting \reflink{RVOController.velocity} would not work because of a bug. (regression from 4.3.x).
  78.     - Fixed setting \reflink{RichAI.rotation} while the agent was stationary would rotate the agent, but it would immediately rotate back to the previous heading.
  79.     - Fixed the Teleport function not working properly for \reflink{LocalSpaceRichAI}.
  80.     - Fixed the inspector for \reflink{LocalSpaceRichAI} not showing the very important \a graph field, making it very hard to use. This is a recent regression.
  81. --
  82. 2.20.1
  83.  
  84.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement