What's a good observable to plug into to get the XR controller orientation on each frame?

I’ve looked around the docs, but just can’t seem to find a good observable to plug into so that I can have the XR controller’s orientation on every frame.
For example, I can easily plug into the xr.input.onControllerAddedObservable which gives me the inputSource. I want a similar one that will be called on every frame.

Or maybe there is a better observable that will only be called when the XR controller’s orientation changes (aka the user turns the controller).

So here’s a code snippet of what I was talking about earlier, but I need it to be happening on every frame though:

xr.input.onControllerAddedObservable.add(inputSource => {
const ray = new Ray(inputSource.pointer.absolutePosition, inputSource.pointer.forward, Infinity);

    // The ray will supposedly give me the position and orientation of the pointer


Any help or even pointers to the appropriate docs will be appreciated. I know @RaananW probably knows the answer. Thanks for accepting my pull request BTW.

There isn’t a specific one, but that is not a bad thing. Just use a scene before render. They run every frame. Just reference the inputsource.pointer that you previously retrieved. This is the same thing you would do for any other object.


Thanks @JCPalmer

Just tried. Works as expected! Any suggestions on how to change the default
“circle” shape that is drawn whenever the controller’s ray intersects a mesh(in my case it’s just a flat box)?

Thanks for taking the time to respond.