Hi,
At the moment I’m running into a problem with WebXRControllerPhysics:
https://playground.babylonjs.com/#M3BUK3#2
I am trying to get velocity of the controller, for which I need the physicsImpostor. However _controllers
does not seem to get populated. Since this is all new functionality I’m probably doing something wrong, so the question is: how do I enable WebXRControllerPhysics correctly?
Actually, I think I got it to work 
https://playground.babylonjs.com/#M3BUK3#3
I’m pretty sure that some other things will pop up regarding WebXR features so I’ll post all the relevant questions here.
Edit:
So the next problem: getLinearVelocity seems to be stuck at 0 when moving the controllers around in the Firefox WebXR emulator:
https://playground.babylonjs.com/#M3BUK3#4
1 Like
@RaananW
Could you show me an example of how to use WebXRControllerPhysics to obtain the velocity of the controllers?
Also, is it possible to obtain the impact force of a collision from the physics engine?
Hey!
I wrote an entire answer and thought it was sent, but it seems like it never did. I am so sorry about that!
Anyhow - this is the result I get in the emulator:
You will need to constantly move your controller (preferably with the squared-controllers and not the arrows so you at least get 2 axes), and make sure you are reading the right controller. You are using the index (0) of the controller array, which will give you unexpected results. The first controller in this array is just the first one that was initialized, it might be the right handed and might be the left handed.
The controllers array indeed seems to be the problem. I keep making the mistake of assuming XR related things are always available, but obviously everything is only initialized after entering XR.
One more question: for slow movements the collision detection between a controller impostor and a sphere seems to work fine, but for faster movements it doesn’t detect the collision for some reason. Example with this playground: com.oculus.browser-20201007-181236 .
Obviously they are colliding and the physics seem to work, but registerOnPhysics collide doesn’t react. Do you have any idea why?
That’s an interesting issue 
Want to reproduce this on the playground? I will be able to test it and give you an answer
Sure, the playground link was hidden in front of the video link
: https://playground.babylonjs.com/#M3BUK3#11
1 Like