Version 1.0 - Stable
This commit is contained in:
+4
-10
@@ -136,14 +136,7 @@ function parseMapIni(iniText: string): TrackMapConfig {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert world coordinates to map pixel coordinates using AC's formula
|
||||
* Trying with coordinate rotation
|
||||
*/
|
||||
/**
|
||||
* Convert world coordinates to map pixel coordinates
|
||||
* Based on working formula with potential rotation fix
|
||||
*/
|
||||
|
||||
export function worldToMapCoords(
|
||||
worldX: number,
|
||||
worldY: number,
|
||||
@@ -153,7 +146,8 @@ export function worldToMapCoords(
|
||||
var aspectRatio = config.width / config.height;
|
||||
|
||||
// Add offsets to player position
|
||||
|
||||
console.log("config" , config);
|
||||
console.log("aspectRatio:", aspectRatio);
|
||||
if (aspectRatio < 1) {
|
||||
worldX = worldX * aspectRatio;
|
||||
} else {
|
||||
@@ -167,7 +161,7 @@ export function worldToMapCoords(
|
||||
x /= config.scaleFactor;
|
||||
|
||||
// Percentages
|
||||
x = (x * 100) / (config.width);
|
||||
x = (x * 100) / (config.width);
|
||||
y = (y * 100) / (config.height);
|
||||
|
||||
return { x, y };
|
||||
|
||||
Reference in New Issue
Block a user