Convert screen position (pixels) to physics position (meters).
IMPORTANT: Only handles scaling conversion between pixels and meters. If converting from screen coordinates, subtract arena position offsets first.
Example:
const arenaRelativeX = screenX - bounds.x; // Remove arena offsetconst arenaRelativeY = screenY - bounds.y; // Remove arena offsetconst physicsPos = pixelsToMeters({ x: arenaRelativeX, y: arenaRelativeY }, bounds); Copy
const arenaRelativeX = screenX - bounds.x; // Remove arena offsetconst arenaRelativeY = screenY - bounds.y; // Remove arena offsetconst physicsPos = pixelsToMeters({ x: arenaRelativeX, y: arenaRelativeY }, bounds);
Korean: 픽셀을미터로 (Pixels To Meters)
Position in pixels RELATIVE to arena origin (subtract bounds.x/y first)
Arena bounds for conversion
Position in meters
Error if pixel coordinates are not finite numbers
Convert screen position (pixels) to physics position (meters).
IMPORTANT: Only handles scaling conversion between pixels and meters. If converting from screen coordinates, subtract arena position offsets first.
Example:
Korean: 픽셀을미터로 (Pixels To Meters)