docs: update Hit Test tutorial to use getInputSourceState instead of deprecated useXRHandState#454
docs: update Hit Test tutorial to use getInputSourceState instead of deprecated useXRHandState#454micronic85 wants to merge 2 commits intopmndrs:mainfrom
Conversation
|
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 |
This PR updates the Hit Test tutorial (
hit-test.md) to replace the deprecateduseXRHandStatehook with the currentgetInputSourceStateapproach from@react-three/xr.Changes:
useXRHandStatewithgetInputSourceStateLet me know if any further tweaks are needed!