onViewMatrixChangedObservable does not trigger on VRCamera


#1

Hi there! I am using the vrHelper for a basic WebVR - project and would like to get the current rotation of the headset(oculus go). It is fired in with the default camera but not in VR. So I was wondering if I am using the ‘observable’ in a wrong way otherwise it might be a bug.

You can check out the playground to reproduce this issue.
https://www.babylonjs-playground.com/#RIXKXP#7


#2

Adding @trevordev who might help :slight_smile:


#3

:blush:
Thx, I found the ‘onPoseUpdatedFromDeviceObservable’ implemented by @trevordev and it is working, yeah! Unfortunately this action fires always, maybe because the gyro sensors are so sensible that it is impossible to keep the device still and not trigger it.


#4

Glad you found a solution, maybe caching the last position and checking to see the difference between frames if you want to only do something only on a large movement.


#5

Yes, I think throttling the sensibility would be the best for my project. Because if the observer is fires almost every frame, I could check it directly in the renderloop, right?
As the webVR Camera inherits from the free Camera I expected a similar behaviour for the ‘onViewMatrixChangedObservable’ like for the standard camera. Maybe it might be worth to note this in the docs, oh and thank you for your quick response.


#6

Yep, I think checking in the renderloop would work as well.