Fix raycast intersection calculation
This commit is contained in:
@@ -447,9 +447,9 @@ f32 bzTileMapRayCast(BzTileMap *map, Vector2 from, Vector2 to, f32 maxDst, Vecto
|
|||||||
|
|
||||||
if (outIntersection) {
|
if (outIntersection) {
|
||||||
Vector2 intersection = from;
|
Vector2 intersection = from;
|
||||||
intersection = Vector2Add(intersection, Vector2Scale(dir, distance));
|
|
||||||
intersection.x *= map->tileWidth;
|
intersection.x *= map->tileWidth;
|
||||||
intersection.y *= map->tileHeight;
|
intersection.y *= map->tileHeight;
|
||||||
|
intersection = Vector2Add(intersection, Vector2Scale(dir, distance));
|
||||||
*outIntersection = intersection;
|
*outIntersection = intersection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user