Hi @RaananW! (Sorry I’ve been bugging you a lot lately )
I’m trying to create an immersive pick-up and throw a mesh behavior. To do this I’ve converted the xr controller grip squeeze component into an rxjs observable subject so that I can use do stuff with it:
// check if squeeze is available
const squeeze = motionController.getComponentOfType('squeeze')
if (squeeze) {
// check its state and handle state changes
squeeze.onButtonStateChangedObservable.add(component => {
this.signalHub.controllerComponentStream$.next({
handedness: motionController.handedness,
component: "squeeze",
pressed: component.pressed,
touched: component.touched
})
})
}
One of the things I did with the rxjs data stream is I output it to a GUI texture so that I could “console.log” the data while wearing the Oculus Quest.
What I noticed is that “most” of the time, pressing and releasing a component (such as trigger or squeeze) will produce 4 distinct messages:
{handedness: "left", component: "squeeze", pressed: false, touched: true}
{handedness: "left", component: "squeeze", pressed: true, touched: true}
{handedness: "left", component: "squeeze", pressed: false, touched: true}
{handedness: "left", component: "squeeze", pressed: false, touched: false}
This makes sense as the component is transitioning from lightly touched to fully pressed and then back again in reverse order.
However, once in a while I’ll see duplicate back to back messages such as:
{handedness: "left", component: "squeeze", pressed: true, touched: true}
{handedness: "left", component: "squeeze", pressed: true, touched: true}
Or
{handedness: "left", component: "squeeze", pressed:false, touched: true}
{handedness: "left", component: "squeeze", pressed:false, touched: true}
Where the exact same message is delivered more than once.
And lightly touching the squeeze will produce a stream of duplicate events like this image shows:
My question is, is this expected behavior?
Shouldn’t the onButtonStateChangedObservable produce distinct states from one invocation to the next?