VR laser pointer and performance


I noticed a large performance drop when the VR laser pointer hits an object with a lot of vertices/faces.

This can be reproduced with the following Playground link: Babylon.js Playground
It creates a mesh with about 2 million vertices.

If I view this scene in VR ( using Firefox and Oculus Rift ) it is working fine.
But as soon as the laser pointer touches the mesh the VR gets totally frozen.

The mesh is neither pickable nor does it have enablePointerMoveEvents or checkCollisions set to true.
So I wonder what influence the mesh has on the ray.

Best regards,

Hello you can exclude the mesh from the list of potential targets but updating the selection predicate like that:

vrHelper.raySelectionPredicate = (mesh) => {
        return mesh.name !== "sphere1"

Same for gaze with meshSelectionPredicate

example: https://www.babylonjs-playground.com/#J3P4IT#1

Another option is to set mesh.isPickable = false and then wrap the object in an invisible bounding box or sphere that is pickable if interaction is still required.

Hi trevordev,
that is what I did. I created an invisible box around the object and only made this box pickable.
But I thought that the selectionPredicate is only used on gazing devices.
@Deltakosh: Thank you very much. Adding the predicates resolved the issue.

In case someone is interested.
I updated the Playground link to have a complex mesh which is not pickable and excluded from the ray surrounded by an invisible box which is selectable.


best regards

1 Like