react-three-rapier icon indicating copy to clipboard operation
react-three-rapier copied to clipboard

one-way-platform issue

Open driescroons opened this issue 1 year ago โ€ข 1 comments

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

  • yarn
  • cd demo
  • yarn dev
  • click to let the ball jump

Type of change

  • ๐Ÿ› Bug fix
  • โœจ New feature
  • ๐Ÿ“ฆ Other (tests, refactoring, docs, etc.)

Checklist:

  • [ ] ๐Ÿ” I have performed a self-review of my code
  • [ ] ๐Ÿ’ฌ I have commented my code, particularly in hard-to-understand areas
  • [ ] ๐Ÿ“— I have made corresponding changes to the documentation
  • [ ] โญ๏ธ My changes generate no new warnings
  • [ ] ๐Ÿงช I have added tests
  • [ ] ๐ŸŸข All new and existing unit tests pass

driescroons avatar Jan 29 '24 01:01 driescroons

โš ๏ธ 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

changeset-bot[bot] avatar Jan 29 '24 01:01 changeset-bot[bot]