I recorded a short video where I interact with two WebXR demos using Oculus Quest 2’s browser. I noticed that the result of my interactions most often did not match my expectations.
- In the first demo I could often drag the box even if the laser pointer was not intersecting with the box itself; Also, in the first video, I wanted to move the blue box, but I had to get really close to it and I could only move it if the pointer landed in some specific area on it, while the rest of its surface was ignored;
- In the second demo the result of shooting at the boxes and red balls can be quite unpredictable, sometimes the object will fly away and sometimes it’ll barely budge. Shooting at the ground close by will just swallow the ball, while shooting a bit further will cause for ball to glide on the ground. Shooting smaller gray balls is most often completely ignored.
Here is a video that I mentioned:
BabylonJS WebXR demos acting weird - YouTube.
Demos can be found here:
I have the following questions:
- Did I somehow do something that caused this behaviour?
- Should this behaviour be considered normal?
- Is collision detection in WebXR (VR concretely) considered stable?
- Can I do something to improve collision detection?
Nope, you did nothing wrong. This is the correct behavior
This is a limitation of the physics engine used in the demo. Any physics engine has certain limitations to the collision detection it is running. There are always ways to improve this
Yes, increase the number of iterations the physics engine is running, or make the ball bigger.
The cannonjs plugin constructor accepts number of iterations as the 2nd variable. Pass a large integer. something like 50 or 100 and see if it improves. Otherwise you can make your objects bigger (especially the bullets)
Hi @RaananW, thanks for the reply.
I’ll play a bit more with the
iterations parameter as you’ve suggested and post the results.
Do you have a suggestion on how can I improve grabbing blocks for the first demo? You can see the video that I’ve posted for the reference that I was able to grab a block even if I were clearly aiming at the ground or at the air past that block.
I’ll have to check the code, but I’m away for a little while now.
The pointer system works just like clicking in the scene with your mouse. What you are describing shouldn’t happen. I assume it happens die to the code written and not the pointer support, but i can’t be sure without debugging this. Sorry again, but that would take some time…