I just spent a majority of a day figuring out why my VR controller pointers always returned null despite setting all meshes to pickable and clearly seeing the selection marker when I realized that I had written
Here is my two cents - you passed the wrong parameter. This is the same as passing anything else other than a string to the name of a mesh.
Using typescript will help here - a string must be passed. if anything else is passed (or a wrong string) it will fail silently. If you ask why it fails silently (and doesn’t throw an exception) - in XR it’s better to continue rendering.
still unsure if that’s the ideal solution since it’ll run every frame for people doing something every frame like a hover check over a mesh.
I think one better solution would be to have a method like getMeshUnderPointerRight and getMeshUnderPointerLeft if we know which ones are left hand or right hand. or use numerical index to get the inputSource instead of id? something so that the user doesn’t need to pass in a param would be nice
I think ideally there should be a warning given to the user when returning null with the wrong param. this at least shouldn’t affect performance if the user is providing the correct param and the controller is found without issue.
I also added a way to get the controller via index instead. This might be more useful for debugging if you somehow don’t have the id and/or need to just see if the picking is working at all for any controller by checking controller index 0
I guess it’s the same even if we put that check in the fail block, huh. the problem is it lacks precedent so yeah, if we do it here we should do it everywhere else.
For now, I have the issue solved by just using uniqueId properly so I personally don’t really need the method to start accepting InputSource as params instead. I only suggest adding a by numerical index method so it might be easier to debug in the future then