Skip to content

Conversation

HussainAther
Copy link

What?

Adds validation checks to the body-helper component to catch malformed or invalid physics config values at runtime.

Why?

To help prevent subtle bugs and improve error reporting when malformed .glb or Spoke-authored scenes define bad physics parameters (e.g., mass: NaN, type: null, etc.).

Examples

  • Logs a warning and clamps mass if it’s NaN
  • Logs and resets type if not one of dynamic, static, or kinematic
  • Restores default gravity if vector is missing or broken

How to test

  1. Add malformed body-helper values via Spoke or custom glTF.
  2. Load the scene in Hubs.
  3. Confirm that helpful warnings are logged and simulation continues gracefully.

Documentation of functionality

No end-user doc updates required. This improves developer-facing behavior.

Limitations

  • Only mass, type, and gravity are validated so far.
  • Other values could be added in a follow-up.

Alternatives considered

  • Throwing hard errors on bad config (too aggressive)
  • Silently correcting values (less developer-friendly)

Open questions

  • Should this logic be moved to a shared validator util for use in other components?

Additional details or related context

Related to stability issues from malformed input in Spoke or manually edited GLB files.

@DougReeder DougReeder changed the base branch from master to addons June 4, 2025 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants