Large Worlds

The Foresight Development Kit is designed to handle coordinate systems spanning hundreds or thousands of kilometers. At this scale, standard 32-bit floating-point numbers lack sufficient precision to represent local offsets, leading to visual jitter for objects far from the origin.

To solve this, the SDK implements a high-precision coordinate system using double-precision transforms combined with a Floating Origin technique.

The Object Model: Persistent State

For most developers, the primary way to interact with world space is through the Object Model. This is the high-level, version-controlled state that defines your project.

When you are writing business logic—such as creating an object, move it to a specific location, or defining its orientation—you should work with the Object Model Transform.

Transform64: Low-level Execution

While the Object Model defines the project’s state, Transform64 is the low-level Bevy ECS component used for real-time computation and rendering.

For entities managed by the versioned state system, the Transform64 component is automatically derived from the Object Model’s Transform state. This ensures that the 3D viewport stays in sync with the authoritative project data.

However, the ECS is not limited to versioned objects. You can spawn arbitrary entities directly into the ECS—such as particle effects, temporary gizmos, or internal simulation helpers—that exist outside of the versioned state system. These entities can still leverage Transform64 for high-precision positioning without being persisted or synchronized across the network.

If you are building custom Bevy plugins, implementing real-time simulation logic (like a physics solver), or optimizing hardware-specific integrations, you will interact directly with Transform64.

  • Engine Integration: Transform64 is the high-precision counterpart to Bevy’s standard Transform.
  • Performance: Manipulating ECS components is highly efficient, making it the preferred choice for logic that runs every frame.
// Spawn a new entity with a high-precision transform
commands.spawn((
    Transform64::from_xyz(1234567.89, 9876543.21, 100.0),
    // ... other components
));

Floating Origin

Because GPUs are optimized for 32-bit floats, we cannot render in 64-bit space directly. The SDK uses a Floating Origin to bridge this gap.

The Floating Origin is a global resource that defines the “center” of the 32-bit world, typically kept near the active camera. As the camera moves, the SDK periodically updates this origin. By keeping the origin close to the camera, the relative distance to visible objects remains small enough to be accurately represented by 32-bit floats, eliminating jitter.

Technical Details

The SDK manages high-precision positioning through a multi-stage transformation pipeline that bridges 64-bit world space with 32-bit GPU rendering:

  1. Transform64: The source of truth for an entity’s local position and orientation using 64-bit floats.
  2. GlobalTransform64: Automatically computed by the FloatingOriginPlugin, this component stores the absolute world-space position after parent-child propagation has been applied.
  3. Floating Origin: A global resource that tracks the current center of the 32-bit rendering world (usually centered on the active camera).
  4. GlobalTransform (32-bit): The final step in the pipeline. The SDK subtracts the Floating Origin from the GlobalTransform64 and casts the result to 32-bit floats. This standard Bevy component is then used by the GPU for rendering.

By keeping the Floating Origin near the camera, the relative offsets in the 32-bit GlobalTransform remain small, preserving the precision required to eliminate visual jitter.

  • Update Pipeline: The FloatingOriginPlugin manages this propagation and conversion in the PostUpdate and PostStartup schedules.
  • Custom Semantics: Developers can manually manage GlobalTransform64 to implement custom parent-child relationships or map specialized GIS coordinates directly to world space.