Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

140
Views
A-Frame - Object intersections are returning null on Safari browser and iOS related devices

I have the following component registered to my 3D glb object:

AFRAME.registerComponent('room', {
init: function() {

    let mesh = this.el.getObject3D('mesh')

    if (!mesh) {
        this.el.addEventListener('model-loaded', () => {
            el.addEventListener("click", evt => {
                console.log(evt)
                if (evt.detail !== null) {
                    this.intersection = evt.detail.intersection
                }
            });
        })
    }
},
});

In my camera object, I have placed the cursor with the raycaster attached:

    <a-entity camera-listener id="rig" class='rig' movement-controls="speed: 0.1;" navigator="cameraRig: #rig; cameraHead: #camera-rig;">
      <a-entity id="camera-rig" camera="active: true" position="0 1.6 0" look-controls="pointerLockEnabled: false; reverseMouseDrag: true">
        <a-entity id="mouseCursor" cursor="rayOrigin: mouse" raycaster="objects: .collidable"></a-entity>
      </a-entity>
      <a-entity laser-controls="hand: left" visible="true" raycaster="objects: .collidable;"></a-entity>
      <a-entity laser-controls="hand: right" visible="true" raycaster="objects: .collidable;"></a-entity>
    </a-entity>

When testing the app on Chrome, Firefox and Android devices the variable "evt" returns with a detail attribute that is not null that can be assigned to decide which child element of my glb object has been clicked. It works for me perfectly in these cases.

However, on Safari and iOS devices, the detail attribute of "evt" is always null and causes my app to crash if not checked. The check is easy but the main issue is that on these browsers I cannot detect which child object has been clicked from my glb as part of the scene.

Is there another way of raycasting that works across all browsers or have I made a mistake with my configuration? Any help would be much appreciated.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!