Files
nexus/wiki/concepts/LargeWorldCoordinates.md
2026-05-03 05:42:12 +08:00

1.8 KiB
Raw Blame History

title, type, tags, sources, last_updated
title type tags sources last_updated
LargeWorldCoordinates concept
unreal-engine
coordinates
precision
open-world
unreal-world-builder
2026-04-30

Aliases

  • LWC
  • Large World Coordinates
  • 大世界坐标
  • 双精度坐标

Definition

Large World CoordinatesLWC是 Unreal Engine 5 引入的双精度double坐标系统用于解决超大世界任何轴超过 2km中的浮点精度问题。无 LWC 时,约 20km 处开始出现可见的浮点精度错误。

Precision Problem

IEEE 754 单精度浮点数float在以下场景产生精度损失

  • 大数值:坐标值越大,相邻值之间的 gap 越大
  • 远距离相加:大坐标值与小数值的加法丢失精度
  • 累积误差:多次变换后误差累积

LWC Enabling Threshold

  • 强制启用:世界任何轴超过 2km
  • 精度损失临界点~20km无 LWC 时可见)
  • 最大安全范围:建议 100km 以内(即使启用 LWC

Code Changes Required

位置 float → double 替代
游戏性代码(位置计算) FVectorFVector3d
着色器/材质 直接世界位置采样 → LWCToFloat() 转换
网络复制 仍用单精度(本地双精度,复制时转换)

LWC Compliance Audit

迁移到 LWC 时必须审查:

  • 所有着色器和材质使用 LWCToFloat() 而非直接世界位置采样
  • 游戏中所有位置计算使用 FVector3d
  • 在 100km 以外spawn玩家并验证无视觉/物理瑕疵

Connections

Sources