Skip to content

Remove unsafe ColliderAabb initialization#669

Merged
Jondolf merged 2 commits into
mainfrom
fix-unsafe-aabb-initialization
Mar 21, 2025
Merged

Remove unsafe ColliderAabb initialization#669
Jondolf merged 2 commits into
mainfrom
fix-unsafe-aabb-initialization

Conversation

@Jondolf

@Jondolf Jondolf commented Mar 21, 2025

Copy link
Copy Markdown
Member

Objective

#527 used a read-only UnsafeWorldCell for the initialization of ColliderAabb in an on_add hook for Collider. However, it uses methods that provide mutable access, which is unsafe and panics with debug assertions.

Solution

Remove the whole AABB initialization logic and use of unsafe. Having it didn't make sense since the initial positions are likely wrong anyway.

ColliderAabb is now explicitly specified to be ColliderAabb::INVALID until the first physics update.

@Jondolf Jondolf added C-Bug Something isn't working A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality P-Crash A sudden unexpected crash labels Mar 21, 2025
@Jondolf Jondolf added this to the 0.3 milestone Mar 21, 2025
@Jondolf Jondolf enabled auto-merge (squash) March 21, 2025 11:23
@Jondolf Jondolf disabled auto-merge March 21, 2025 11:23
@Jondolf Jondolf enabled auto-merge (squash) March 21, 2025 11:27
@Jondolf Jondolf merged commit da07cc2 into main Mar 21, 2025
@Jondolf Jondolf deleted the fix-unsafe-aabb-initialization branch March 21, 2025 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality C-Bug Something isn't working P-Crash A sudden unexpected crash

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant