File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
src/bundles/robot_minigame Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ export function get_distance() : number {
265265 const obstacleCollisions : Collision [ ] = robot_raycast ( ( area : Area ) => area . isObstacle ) ;
266266
267267 // If an obstacle is found, return its distance
268- if ( obstacleCollisions . length > 0 ) return obstacleCollisions [ 0 ] . distance ;
268+ if ( obstacleCollisions . length > 0 ) return obstacleCollisions [ 0 ] . distance - robot . radius ;
269269
270270 // Find the distance to the bounds
271271 const boundsCollision : Collision | null = robot_raycast_area ( {
@@ -274,7 +274,7 @@ export function get_distance() : number {
274274 flags : { }
275275 } ) ;
276276
277- return boundsCollision === null ? Infinity : boundsCollision . distance ;
277+ return boundsCollision === null ? Infinity : boundsCollision . distance - robot . radius ;
278278}
279279
280280/**
You can’t perform that action at this time.
0 commit comments