docs: update Hit Test tutorial to use getInputSourceState instead of deprecated useXRHandState
This PR updates the Hit Test tutorial (hit-test.md) to replace the deprecated useXRHandState hook with the current getInputSourceState approach from @react-three/xr.
Changes:
- Replaced all references to
useXRHandStatewithgetInputSourceState - Adjusted related explanation text and code samples
- Ensured consistency with current API usage
Let me know if any further tweaks are needed!
Thanks for the PR!
The correct hook in this case is "useXRInputSourceStateContext()", so the developer does not have to provide information about the input source type and its handedness because its provided through the context :)
Thanks for the clarification, @bbohlender!
That makes sense. Using useXRInputSourceStateContext() is indeed a better approach as it automatically retrieves the type and handedness from the context, simplifying the API for the user.
I've updated the PR to replace xr.getInputSourceState("hand", "right") with useXRInputSourceStateContext() as suggested.
const store = createXRStore({
hand: {
right: () => {
const state = useXRInputSourceStateContext();
// ...
}
}
});
This makes it clearer how the state retrieved from the context is then used within the hand configuration function.
@micronic85 I don't see the update you mentioned beeing applied to the files :)
@bbohlender, I've updated the code