Conversation
Co-authored-by: dyfios <16926525+dyfios@users.noreply.github.com>
Co-authored-by: dyfios <16926525+dyfios@users.noreply.github.com>
Co-authored-by: dyfios <16926525+dyfios@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update world offset when character entity moves away from origin
Add automatic world offset updates for character entities to maintain floating-point precision
Oct 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements automatic world offset updates that trigger when a tracked character entity moves beyond a configurable distance from the Unity origin. This feature helps maintain floating-point precision and ensures consistent gameplay as characters travel far from the origin.
Problem
Currently, the world offset in
World.csdoes not update automatically when character entities move significant distances from the world origin. This can lead to:Solution
The implementation adds three key components to the
Worldclass:1. Character Tracking
2. Configurable Threshold
3. Automatic Recentering
The
Update()method monitors the tracked character's Unity position and automatically recenters the coordinate system when the distance exceeds the threshold:Technical Details
Offset Calculation:
newOffset = oldOffset - unityPositionThis formula ensures that:
Example:
Changes
SetTrackedCharacterEntity()method, andUpdate()implementationBenefits
Testing
Added
WorldTests_WorldOffsetUpdate()test that verifies:Closes #[issue_number]
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.