Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From f0f02ebab425320d90e9920af69250d67d3e733f Mon Sep 17 00:00:00 2001
- From: Aron Granberg <[email protected]>
- Date: Wed, 23 Feb 2022 11:33:47 +0100
- Subject: [PATCH 1/9] Fixed RVOController.velocity not working.
- ---
- Assets/AstarPathfindingProject/Core/RVO/RVOAgentBurst.cs | 6 ++++--
- .../Core/RVO/RVOCoreSimulatorBurst.cs | 5 ++---
- Assets/AstarPathfindingProject/changelog.cs | 2 +-
- 3 files changed, 7 insertions(+), 6 deletions(-)
- diff --git a/Assets/AstarPathfindingProject/Core/RVO/RVOAgentBurst.cs b/Assets/AstarPathfindingProject/Core/RVO/RVOAgentBurst.cs
- index b84ac93b..a025557e 100644
- --- a/Assets/AstarPathfindingProject/Core/RVO/RVOAgentBurst.cs
- +++ b/Assets/AstarPathfindingProject/Core/RVO/RVOAgentBurst.cs
- @@ -502,7 +502,8 @@ namespace Pathfinding.RVO.Sampled {
- for (int agentIndex = startIndex; agentIndex < endIndex; agentIndex++) {
- if (agentData.manuallyControlled[agentIndex]) {
- - // TODO
- + output.speed[agentIndex] = agentData.desiredSpeed[agentIndex];
- + output.targetPoint[agentIndex] = agentData.targetPoint[agentIndex];
- continue;
- }
- @@ -565,7 +566,8 @@ namespace Pathfinding.RVO.Sampled {
- for (int agentIndex = startIndex; agentIndex < endIndex; agentIndex++) {
- if (agentData.manuallyControlled[agentIndex]) {
- - // TODO
- + output.speed[agentIndex] = agentData.desiredSpeed[agentIndex];
- + output.targetPoint[agentIndex] = agentData.targetPoint[agentIndex];
- continue;
- }
- diff --git a/Assets/AstarPathfindingProject/Core/RVO/RVOCoreSimulatorBurst.cs b/Assets/AstarPathfindingProject/Core/RVO/RVOCoreSimulatorBurst.cs
- index d8c1df20..96368129 100644
- --- a/Assets/AstarPathfindingProject/Core/RVO/RVOCoreSimulatorBurst.cs
- +++ b/Assets/AstarPathfindingProject/Core/RVO/RVOCoreSimulatorBurst.cs
- @@ -441,10 +441,8 @@ namespace Pathfinding.RVO {
- public void ForceSetVelocity (Vector3 velocity) {
- // A bit hacky, but it is approximately correct
- // assuming the agent does not move significantly
- - // TODO: non-burst also sets simulator.outputData.targetPoint
- simulator.simulationData.targetPoint[agentIndex] = simulator.simulationData.position[agentIndex] + (float3)velocity * 1000;
- simulator.simulationData.desiredSpeed[agentIndex] = velocity.magnitude;
- - // TODO: non-burst also sets CalculatedSpeed
- simulator.simulationData.manuallyControlled[agentIndex] = true;
- }
- }
- @@ -973,6 +971,7 @@ namespace Pathfinding.RVO {
- // The normal is reset every simulation tick
- // Note that the copied data still contains the real normal.
- var clearJob = simulationData.collisionNormal.MemSet(float3.zero).Schedule(JobHandle.CombineDependencies(copyJob, preprocessJob));
- + var clearJob2 = simulationData.manuallyControlled.MemSet(false).Schedule(JobHandle.CombineDependencies(copyJob, preprocessJob));
- int batchSize = math.max(numAgents / 32, 4);
- var neighboursJob = new JobRVOCalculateNeighbours<T> {
- @@ -1027,7 +1026,7 @@ namespace Pathfinding.RVO {
- var rvoJob = rvoJobData.ScheduleBatch(numAgents, batchSize, combinedJob);
- JobHandle.ScheduleBatchedJobs();
- - JobHandle.CombineDependencies(combinedJob, clearJob).Complete();
- + JobHandle.CombineDependencies(combinedJob, clearJob, clearJob2).Complete();
- if (DoubleBuffering && !anyDebugEnabled[0]) {
- inProgressJob = rvoJob;
- diff --git a/Assets/AstarPathfindingProject/changelog.cs b/Assets/AstarPathfindingProject/changelog.cs
- index 56104a04..c8cae138 100644
- --- a/Assets/AstarPathfindingProject/changelog.cs
- +++ b/Assets/AstarPathfindingProject/changelog.cs
- @@ -8,7 +8,7 @@
- - Fixed some smaller memory memory leaks in the unity editor.
- - Fixed some warnings related to ENABLE_UNITY_COLLECTIONS_CHECKS which burst would log when building a standalone player.
- - Fixed AIPathAlignedToSurface would throw an exception if no RVOController was attached.
- - - Fixed setting \reflink{RVOController.velocity} would be buggy except in 2D space (regression from 4.3.x).
- + - Fixed setting \reflink{RVOController.velocity} would not work because of a bug. (regression from 4.3.x).
- - Fixed setting \reflink{RichAI.rotation} while the agent was stationary would rotate the agent, but it would immediately rotate back to the previous heading.
- - Fixed the Teleport function not working properly for \reflink{LocalSpaceRichAI}.
- - 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.
- --
- 2.20.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement