pmndrs / react-three-rapier

🀺 Rapier physics in React
https://react-three-rapier.pmnd.rs
MIT License
1.03k stars 57 forks source link

one-way-platform issue #603

Open driescroons opened 7 months ago

driescroons commented 7 months ago

Description

PR for https://github.com/pmndrs/react-three-rapier/issues/597

We can get one-way-platforms to work by passing an additional hooks param to world.step(eventQueue, hooks) of type PhysicsHooks.

In order for us to get access to this in components, I added filterContactPairHooks and filterIntersectionPairHooks to useRapier.

This allows us to register a hook in our OneWayPlatform.jsx demo that we can push to filterContactPairHooks. We also need to make sure we set setActiveHooks to one for either our ball or platform.

This works, but when I try to get access to body's linvel or translation in the hook, from either the ref, or the params I get the above error. How am I able to access the body in that hook?

Run locally

Type of change

Checklist:

changeset-bot[bot] commented 7 months ago

⚠️ No Changeset found

Latest commit: 45087bf925760f4e335a4af7f8c3f55e9ad2f61b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR