refactor: use cardinal.EntityID directly in physics2d contact types#890
Merged
AnthonyWadham merged 1 commit intomainfrom Apr 24, 2026
Merged
refactor: use cardinal.EntityID directly in physics2d contact types#890AnthonyWadham merged 1 commit intomainfrom
cardinal.EntityID directly in physics2d contact types#890AnthonyWadham merged 1 commit intomainfrom
Conversation
Contributor
Author
How to use the Graphite Merge QueueAdd the label graphite/merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Closed
6b6ad70 to
ae574a1
Compare
68588cc to
4ec0678
Compare
cardinal.EntityID directly in physics2d contact types
winton-library
approved these changes
Apr 24, 2026
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.

TL;DR
Replace
uint64wire-format conversions for entity IDs with directcardinal.EntityIDusage in the physics2d contact tracking system.What changed?
ContactPairEntrynow storescardinal.EntityIDdirectly forEntityAandEntityBinstead ofuint64. The intermediate conversion functions (entityIDFromUint64) and associated bounds-checking logic have been removed, along with the correspondinguint64(...)casts when writing back to the component.lessContactPairByEndpointsnow acceptscardinal.EntityIDarguments natively, eliminating the explicit casts at call sites.Why make this change?
The previous approach stored entity IDs as
uint64in the component struct and converted them tocardinal.EntityID(auint32) at runtime, requiring explicit bounds checks to guard against silent truncation. Sincecardinal.EntityIDis the canonical type throughout the engine, using it directly removes unnecessary conversions, eliminates the risk of mismatched types, and simplifies the code without any loss of correctness.