Skip to content

fix: Validate translation and rotation data fed to bepu for collidables#3166

Draft
Eideren wants to merge 1 commit into
stride3d:masterfrom
Eideren:validate_collidables
Draft

fix: Validate translation and rotation data fed to bepu for collidables#3166
Eideren wants to merge 1 commit into
stride3d:masterfrom
Eideren:validate_collidables

Conversation

@Eideren
Copy link
Copy Markdown
Collaborator

@Eideren Eideren commented May 11, 2026

PR Details

Bepu does very little validation on their end; sending nans or zeroed quaternion causes memory corruption, this PR places a couple of exception to notify users of their invalid data.

There's also some very minor cleanup and summaries added in. Haven't had any time to test this yet, but let's see if automation catches anything before I find the time to do so.

Related Issue

fix: #3163

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.


ref Matrix4x4 numericMatrix = ref Unsafe.As<Matrix, Matrix4x4>(ref collidable.Entity.Transform.WorldMatrix); // Casting to numerics, stride's equality comparison is ... not great
if (span[i].Value == numericMatrix)
if (iData.Value == numericMatrix)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with that, we should have real equality comparison (currently EqualsStrict) and have an explicit method for epsilon comparison
(of course, not part of this PR, keep as is)

@xen2
Copy link
Copy Markdown
Member

xen2 commented Jun 3, 2026

There's also some very minor cleanup and summaries added in. Haven't had any time to test this yet, but let's see if automation catches anything before I find the time to do so.

Automation looks OK, let me know when ready for merge

@Eideren Eideren marked this pull request as draft June 3, 2026 17:39
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2026

🤖 Draft PR — automatic CI is skipped to save runner minutes.

  • /ci main — what would auto-run if this PR weren't draft
  • /ci allmain + screenshot regression (/ci e2e)
  • /ci help — full list, per-platform and per-suite

Marking ready-for-review re-enables full CI automatically.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stride Bepu Physics: When BodyComponent Teleport used with Quaternion.Zero it breaks this body physics

2 participants