Skip to content

Commit

Permalink
Merge pull request #160 from proepkes/Master
Browse files Browse the repository at this point in the history
 Fix indexoutofboundsexception
  • Loading branch information
SnpM authored Jul 28, 2018
2 parents 5f93bec + 3b32517 commit 5653f4d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Core/Simulation/Physics/Core/PhysicsTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void CircleCast (Vector2d position, long radius, FastList<LSBody>
for (int i = gridXMin; i <= gridXMax; i++) {
for (int j = gridYMin; j <= gridYMax; j++) {
PartitionNode node = Partition.GetNode (i, j);
for (int k = node.ContainedDynamicObjects.Count;k>=0;k--) {
for (int k = node.ContainedDynamicObjects.Count-1;k>=0;k--) {
var body = PhysicsManager.SimObjects [node.ContainedDynamicObjects [k]];
long minFastDist = body.Radius + radius;
//unnormalized distance value for comparison
Expand All @@ -38,7 +38,7 @@ public static void CircleCast (Vector2d position, long radius, FastList<LSBody>
output.Add(body);
}
}
for (int l = node.ContainedImmovableObjects.Count; l >=0; l--) {
for (int l = node.ContainedImmovableObjects.Count-1; l >=0; l--) {
var body = PhysicsManager.SimObjects [node.ContainedImmovableObjects [l]];
long minFastDist = body.Radius + radius;
//unnormalized distance value for comparison
Expand All @@ -53,4 +53,4 @@ public static void CircleCast (Vector2d position, long radius, FastList<LSBody>
}
}
}
}
}

0 comments on commit 5653f4d

Please sign in to comment.