Relaxed path finder "reached" check
This commit is contained in:
parent
d9b25c960d
commit
307c67d976
@ -135,8 +135,8 @@ class PathFinder(val world: World<*, *>, val start: Vector2d, val goal: Vector2d
|
|||||||
// through.
|
// through.
|
||||||
val bottom = standingBox.mins.y
|
val bottom = standingBox.mins.y
|
||||||
|
|
||||||
val x = (pos.x / NODE_GRANULARITY).roundToInt() * NODE_GRANULARITY
|
val x = (pos.x / NODE_GRANULARITY + 0.5).toInt() * NODE_GRANULARITY
|
||||||
val y = ((pos.y + bottom) / NODE_GRANULARITY).roundToInt() * NODE_GRANULARITY - bottom
|
val y = ((pos.y + bottom) / NODE_GRANULARITY + 0.5).toInt() * NODE_GRANULARITY - bottom
|
||||||
return Vector2d(x, y)
|
return Vector2d(x, y)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -671,7 +671,7 @@ class PathFinder(val world: World<*, *>, val start: Vector2d, val goal: Vector2d
|
|||||||
if (closest > node)
|
if (closest > node)
|
||||||
closest = node
|
closest = node
|
||||||
|
|
||||||
if (node.position.distance(goal) <= NODE_GRANULARITY && (!parameters.mustEndOnGround || onGround(node.position) && node.velocity == null)) {
|
if (node.position.distance(goal) <= NODE_GRANULARITY * 2.0 && (!parameters.mustEndOnGround || onGround(node.position) && node.velocity == null)) {
|
||||||
closest = node
|
closest = node
|
||||||
result = KOptional(closest.reconstructPath())
|
result = KOptional(closest.reconstructPath())
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user