From 9113b971440e96f0ca96082807aa394286fea773 Mon Sep 17 00:00:00 2001 From: Colin Wong Date: Tue, 19 Nov 2024 06:39:31 -0600 Subject: [PATCH] fix grid distance checking for shimmy --- src/server/robot/path-materializer.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/server/robot/path-materializer.ts b/src/server/robot/path-materializer.ts index 07e3f29..55f1f60 100644 --- a/src/server/robot/path-materializer.ts +++ b/src/server/robot/path-materializer.ts @@ -257,8 +257,12 @@ function findShimmyLocation( const normalY: number = signedDistY / distHypot; const orth1: Position = new Position(-normalY, normalX); const orth2: Position = new Position(normalY, -normalX); - const orthPos1: Position = orth1.addTuple(move.to.toTuple()); - const orthPos2: Position = orth2.addTuple(move.to.toTuple()); + const orthPos1: Position = orth1.add( + gridIndicesToPosition(move.to), + ); + const orthPos2: Position = orth2.add( + gridIndicesToPosition(move.to), + ); // distance calculations :) const val1: Position = shimmyPos.sub(orthPos1);