Skip to content

Add ClientWorldOrigin and automatic floating-origin shift in ChunkManager#134

Open
ArtifactForms wants to merge 1 commit intomasterfrom
codex/analyze-voxel-client-and-voxel-server-for-rendering-issues
Open

Add ClientWorldOrigin and automatic floating-origin shift in ChunkManager#134
ArtifactForms wants to merge 1 commit intomasterfrom
codex/analyze-voxel-client-and-voxel-server-for-rendering-issues

Conversation

@ArtifactForms
Copy link
Owner

Motivation

  • Prevent floating-point precision issues in client-side rendering by rebasing local coordinates around a movable origin chunk.
  • Allow the client to keep rendering and local calculations numerically stable while the server continues to use absolute coordinates.

Description

  • Introduces a new ClientWorldOrigin class that stores an origin chunk, converts between absolute and local world coordinates, and exposes isOutsideShiftThreshold to detect when to rebase.
  • Adds a ClientWorld.origin instance and exposes it via ClientWorld.getOrigin().
  • Integrates origin usage into ChunkManager: the manager now retrieves the origin from the world, checks isOutsideShiftThreshold each update, and calls setOriginChunk when the player moves past a configurable threshold; also adds originShiftThresholdChunks with getter/setter and a default constant.
  • Exposes the world origin from the client via GameClient.getWorldOrigin() to allow other systems to query local/absolute transforms.

Testing

  • Built the project to verify compilation and integration using ./gradlew build, and the build completed successfully.
  • Ran the project's automated test task using ./gradlew test, and the existing test suite completed without failures.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant