Possible bug with raytracing and the ActionManager on iOS


I’m running 4.0.0 beta1
And using an action manager to handle a hover effect and to toggle som functionality.

This works great when i have a mouse, but it doesn’t seem to work at all in iOS safari.

const actionManager = new ActionManager(this.scene)

      new ExecuteCodeAction({ trigger: ActionManager.OnPointerOverTrigger }, (event: ActionEvent) => {
        const mesh = event.meshUnderPointer

      new ExecuteCodeAction({ trigger: ActionManager.OnPointerOutTrigger }, (event: ActionEvent) => {
        const mesh = event.meshUnderPointer
        mesh.scaling.scaleInPlace(1.0 / 1.1)

      new ExecuteCodeAction({ trigger: ActionManager.OnPickTrigger }, (event: ActionEvent) => {
        const mesh = event.meshUnderPointer
        const view = mesh.metadata as View
        console.log('pick', view)

I’m using pepjs, and the camera controls work as expected, so it must a bug or something that is wrong with the raytracing.

I tried this demo on my iPad and it doesn’t work either.

Nope, I guess the issue is that you do not have hovering in general on mobile.

I understand there is no hovering.
But the OnPickTrigger should work as intended, which is doesn’t.

If you try tapping the sphere in the demo on an ipad or iphone, it will not register the click.

And if you use pointer up does it work?

I’ve now been able to pin point exactly what isn’t working.

When running on touch devices the ActionEvent.meshUnderPointer is most of the time undefined.
if you repeatedly tap the mesh, it sometimes will register with a mesh, but mostly it fails and returns undefined.

I’ve setup this playground to test it out

If you try this on desktop you will get a window.alert with has MeshUnderPointer: true

but on mobile you will not.

Maybe it could be connected with us using pepjs?

Ok so to be sure, you got the pick event but meshUnderPointer is undefined. And you expect it to be set, right?

Exactly since the event was triggered by a actionmanager that was explicitly set on the mesh

Ok I’ll make sure to fix that :slight_smile:

1 Like