-
Notifications
You must be signed in to change notification settings - Fork 71
Description
Hey 👋 I recently came across this example in rust for one way platforms in rapier and tried to recreate the effect.
I'm currently able to let the ball pass through the platform by adding a PhysicsHook
Screen.Recording.2024-01-22.at.00.58.46.mov
However, I'm only able to disable the collision check. I'm not able to access the RigidBody's linvel
, or translation
and it results in an recursive use of an object detected which would lead to unsafe aliasing
error. I'd like to check if the ball is above the platform to enable the collision check again.
How does this currently work?
In order to get this to work we need to be able to pass 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?
Code: #603
Run locally
yarn
cd demo
yarn dev
- click to let the ball jump