Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/react-three-cannon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,20 @@ interface RaycastVehicleProps {
- NaiveBroadphase is as simple as it gets. It considers every body to be a potential collider with every other body. This results in the maximum number of narrowphase checks.
- SAPBroadphase sorts bodies along an axis and then moves down that list finding pairs by looking at body size and position of the next bodies. Control what axis to sort along by setting the axisIndex property.


### Testing with Jest

If Jest reports that it cannot find `@react-three/cannon`, the problem is usually related to the test environment rather than the runtime package itself.

Because `@react-three/cannon` is commonly used in modern React/ESM setups, some Jest configurations may need additional module resolution or transform settings. If you are unit testing components that import physics hooks, consider one of these approaches:
Comment on lines +594 to +598
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

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

The heading level for "Testing with Jest" breaks the FAQ structure: it’s currently an H3 (###) inside the "### FAQ" section, while the surrounding FAQ entries (e.g., "Broadphases", "Types") are H4 (####). As written, this makes "Types" appear as a subsection of "Testing with Jest" instead of a sibling FAQ item. Consider changing this heading to H4 (####) to keep the hierarchy consistent.

Copilot uses AI. Check for mistakes.

- configure Jest to handle ESM dependencies used by your React/Three stack
- mock `@react-three/cannon` in tests that do not need real physics behavior
- keep physics integration in higher-level tests and isolate pure logic into testable helper functions
Comment on lines +600 to +602
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

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

The bullet list items under the new Jest section start with lowercase verbs ("configure", "mock", "keep") while other bullets in this FAQ read like sentences starting with capitals (e.g., "NaiveBroadphase...", "A dynamic body..."). Consider capitalizing these list items (and optionally adding consistent punctuation) for readability and consistency within the README.

Suggested change
- configure Jest to handle ESM dependencies used by your React/Three stack
- mock `@react-three/cannon` in tests that do not need real physics behavior
- keep physics integration in higher-level tests and isolate pure logic into testable helper functions
- Configure Jest to handle ESM dependencies used by your React/Three stack
- Mock `@react-three/cannon` in tests that do not need real physics behavior
- Keep physics integration in higher-level tests and isolate pure logic into testable helper functions

Copilot uses AI. Check for mistakes.

If this issue appears in your project, check your Jest resolver, transform settings, and test environment setup before assuming the package import itself is broken.


#### Types

- A dynamic body is fully simulated. Can be moved manually by the user, but normally they move according to forces. A dynamic body can collide with all body types. A dynamic body always has finite, non-zero mass.
Expand Down
Loading