Babylon.js icon indicating copy to clipboard operation
Babylon.js copied to clipboard

TouchButton3D's getPressDepth(position) call has depth discrepancy

Open rickfromwork opened this issue 3 years ago • 3 comments

When the depth is calculated, the passed-in point is used to get the height off of the surface of the button. This height is then compared against a cached height from when the pointer down event was triggered, and the delta is returned as the press depth.

The problem I see is that the cached depth is based off of the touch mesh (finger tip) position, but queries to getPressDepth() are likely called as part of the onPointer* observable, which just gives the 3D position on the button. So while the touch event triggers when the finger touches the button, the finger itself is still floating a little above the button (just the tip of the finger is touching at this point).

The playground I use to test this is below. When using the Windows Mixed Reality Portal, and simulated controllers, the button appears just in front of the left controller's default position when loading into VR, making testing fairly straight-forwards. https://www.babylonjs-playground.com/#92K1DJ#4

rickfromwork avatar Mar 07 '22 22:03 rickfromwork

Thanks for reporting, Could you provide a repro ?

sebavan avatar Mar 08 '22 00:03 sebavan

Thanks for reporting, Could you provide a repro ?

Added it into the description.

rickfromwork avatar Mar 08 '22 10:03 rickfromwork

@RaananW could you have a look ?

sebavan avatar Mar 08 '22 11:03 sebavan