Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Handtracking fix for near interaction #15023

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kar-re
Copy link

@kar-re kar-re commented Apr 24, 2024

Hi!
I've tested the touchHolographicButton with handtracking using the Quest 3, but it did only work with ray interactions and not with near interactions. This might have something to do with #14787 but I'm unsure.
In order to mitigate this I implemented a kind of hacky solution, checking if the pointer is currently of type xr or xr-near. I'm unsure whether this fix is suitable but I thought it be better to submit this and start a discussion rather than just leave it.

Here's some videos showing the behavior.
Before fix:
before.webm

After fix:
after.webm

This doesn't change the current behavior with ray-interactions but fixes only the near interactions.

Co-authed with @moabjo

@bjsplat
Copy link
Collaborator

bjsplat commented Apr 24, 2024

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@sebavan sebavan requested a review from RaananW April 24, 2024 16:30
Copy link
Member

@RaananW RaananW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just 2 comments and one question :-)

@@ -391,6 +399,14 @@ export class TouchHolographicButton extends TouchButton3D {
this.collisionMesh = collisionMesh;
this.collidableFrontDirection = this._backPlate.forward.negate(); // Mesh is facing the wrong way

this._pointerObserver = scene.onPointerObservable.add((pointerInfo) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must be removed when the component is disposed. It's also the reason the build failed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also should be removed if this function is called again (or if already defined) - stay defensive

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes! I must've missed it. I'll resolve it, thanks! :)


if (this.isActiveNearInteraction && pointerInfo.pickInfo) {
if (pointerInfo.pickInfo.hit)
this._isRay = (<PointerEvent><unknown>pointerInfo.event).pointerType === "xr";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is for general XR and not near interaction, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I believe so. Previously I used

if ((<PointerEvent>pointerInfo.event).pointerType === "xr") {
    this._isRay = true;
}
if ((<PointerEvent>pointerInfo.event).pointerType === "xr-near") {
    this._isRay = false;
}

but since I really only want to know if it is an XR ray interaction going on I simplified it to the code committed in the PR.

So basically I wanted a way to differentiate between XR ray interactions and XR near interactions, but here's where my knowledge regarding the differentiation between XR and XR near interaction stops, so if you have any recommendations or think this doesn't fit with the XR/XR near interaction architecture, let me know and I can continue to debug it or change behavior based on your expertise.

The proposed fix I committed is imo a bit hacky, so if there's any more elegant way to resolve the bug I'm more than happy to implement it with some pointers on where to look! 😊

@RaananW
Copy link
Member

RaananW commented May 8, 2024

Any update on this one?

@kar-re
Copy link
Author

kar-re commented May 8, 2024

Any update on this one?

Turns out I was using an older version of Babylon when testing, so I would like to try it out with the latest version to verify that the bug still exists there. I'll update the PR when I've confirmed that it's there - just need to submit my master thesis first! :)

@RaananW
Copy link
Member

RaananW commented May 8, 2024

Any update on this one?

Turns out I was using an older version of Babylon when testing, so I would like to try it out with the latest version to verify that the bug still exists there. I'll update the PR when I've confirmed that it's there - just need to submit my master thesis first! :)

Master thesis? not THAT important! :-)

Take your time, thanks a lot!!!

@RaananW RaananW marked this pull request as draft May 8, 2024 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants