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.
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?
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
https://github.com/pmndrs/react-three-rapier/assets/27679518/8d8bf38f-2be6-4b09-a9af-fa193ba998bc
However, I'm only able to disable the collision check. I'm not able to access the RigidBody's
linvel
, ortranslation
and it results in anrecursive 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 toworld.step(eventQueue, hooks)
of typePhysicsHooks
.In order for us to get access to this in components, I added
filterContactPairHooks
andfilterIntersectionPairHooks
touseRapier
.This allows us to register a
hook
in ourOneWayPlatform.jsx
demo that we can push tofilterContactPairHooks
. We also need to make sure we setsetActiveHooks
to one for either our ball or platform.This works, but when I try to get access to body's
linvel
ortranslation
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: https://github.com/pmndrs/react-three-rapier/pull/603
Run locally
yarn
cd demo
yarn dev